:root {
  color-scheme: light;
  --background: #fbfaf7;
  --surface: #ffffff;
  --text: #24211d;
  --muted: #6c665d;
  --line: #dfd9cf;
  --accent: #1f6f78;
  --accent-hover: #154f56;
  --accent-soft: #e8f3f4;
  --accent-soft-hover: #dceff1;
  --accent-soft-line: #d3e8ea;
  --folder-row: #eef7f8;
  --folder-row-hover: #dceff1;
  --file-row: #fffaf1;
  --file-row-hover: #fff2da;
  --parent-row: #f1eee8;
  --parent-row-hover: #e8e2d8;
  --parent-divider: #948d82;
  --file-accent: #c8872d;
  --button-bg: rgba(255, 255, 255, 0.74);
  --button-border: rgba(36, 33, 29, 0.16);
  --button-icon: #3f3a32;
  --button-shadow: rgba(36, 33, 29, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #151719;
  --surface: #1d2023;
  --text: #eee9df;
  --muted: #aaa39a;
  --line: #34383d;
  --accent: #7fcfd8;
  --accent-hover: #a4e2e8;
  --accent-soft: #1e3438;
  --accent-soft-hover: #28454a;
  --accent-soft-line: #2e555b;
  --folder-row: #182528;
  --folder-row-hover: #203237;
  --file-row: #242019;
  --file-row-hover: #30291e;
  --parent-row: #202123;
  --parent-row-hover: #282a2d;
  --parent-divider: #76706a;
  --file-accent: #d59a54;
  --button-bg: rgba(29, 32, 35, 0.76);
  --button-border: rgba(238, 233, 223, 0.14);
  --button-icon: #eee9df;
  --button-shadow: rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

.theme-toggle {
  position: fixed;
  display: grid;
  place-items: center;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--button-border);
  border-radius: 999px;
  background: var(--button-bg);
  box-shadow: 0 8px 24px var(--button-shadow);
  cursor: pointer;
  opacity: 0.72;
  backdrop-filter: blur(8px);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 1;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--button-icon);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 140ms ease, transform 140ms ease;
}

.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.site-header,
.site-footer,
.directory-shell,
.document-shell {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
}

.site-header {
  padding: 32px 48px 20px 0;
  border-bottom: 1px solid var(--line);
}

.site-footer {
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
}

h1 {
  margin: 10px 0 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.path-label,
.directory-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.back-link,
.crumbs a {
  font-size: 0.95rem;
  font-weight: 650;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-line);
  border-radius: 6px;
  text-decoration: none;
}

.crumbs a:hover {
  background: var(--accent-soft-hover);
}

.crumbs span {
  color: var(--parent-divider);
}

.directory-shell {
  padding: 24px 0 40px;
}

.listing {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
}

.listing th,
.listing td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.listing th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.listing-row.folder-row {
  background: var(--folder-row);
}

.listing-row.file-row {
  background: var(--file-row);
}

.listing-row.parent-row {
  background: var(--parent-row);
}

.listing-row.folder-row:hover {
  background: var(--folder-row-hover);
}

.listing-row.file-row:hover {
  background: var(--file-row-hover);
}

.listing-row.parent-row:hover {
  background: var(--parent-row-hover);
}

.listing-row.folder-row td:first-child {
  box-shadow: inset 4px 0 0 var(--accent);
}

.listing-row.file-row td:first-child {
  box-shadow: inset 4px 0 0 var(--file-accent);
}

.listing-row.parent-row td:first-child {
  box-shadow: inset 4px 0 0 var(--muted);
}

.listing tr:last-child td {
  border-bottom: 0;
}

.listing a {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.listing .size,
.listing .modified {
  width: 1%;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.document-shell {
  padding: 24px 0;
}

.document-text {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .listing {
    display: block;
    overflow-x: auto;
  }

  .listing .modified {
    display: none;
  }

  .document-text {
    padding: 14px;
    font-size: 0.9rem;
  }
}
