/* Tokyo Night Apache mod_autoindex theme */

:root {
  --bg:        #1a1b26;
  --bg-alt:    #16161e;
  --bg-hl:     #24283b;
  --bg-hover:  #292e42;
  --border:    #414868;
  --fg:        #c0caf5;
  --fg-dim:    #a9b1d6;
  --fg-muted:  #565f89;
  --blue:      #7aa2f7;
  --purple:    #bb9af7;
  --cyan:      #7dcfff;
  --green:     #9ece6a;
  --yellow:    #e0af68;
  --red:       #f7768e;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

body {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* Header injected via header.html */
#tn-header {
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

#tn-header .tn-logo {
  font-size: 1.1rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}

#tn-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--blue);
  word-break: break-all;
}

/* The autoindex table */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

thead tr {
  background: var(--bg-hl);
  border-bottom: 2px solid var(--border);
}

thead th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
  white-space: nowrap;
}

thead th a,
thead th a:visited {
  color: var(--purple);
  text-decoration: none;
}

thead th a:hover { color: var(--cyan); text-decoration: underline; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

tbody tr:last-child { border-bottom: none; }

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

tbody td {
  padding: 0.55rem 1rem;
  vertical-align: middle;
  color: var(--fg-dim);
  white-space: nowrap;
}

/* file/dir name column */
tbody td:nth-child(2) {
  width: 100%;
  white-space: normal;
  word-break: break-all;
}

/* icon column — hide GIF, use CSS icons instead */
tbody td:nth-child(1) {
  padding-right: 0;
  width: 2rem;
  text-align: center;
}

tbody td img {
  display: none;
}

tbody td:nth-child(1)::after {
  content: '·';
  color: var(--fg-muted);
  font-size: 1.2rem;
}

/* folder icon */
tbody tr:has(td:nth-child(2) a[href$="/"]) td:nth-child(1)::after {
  content: '▸';
  color: var(--cyan);
  font-size: 1rem;
}

/* parent directory */
tbody tr:has(a[href="../"]) td:nth-child(1)::after {
  content: '↑';
  color: var(--yellow);
  font-size: 0.9rem;
}

/* size + date columns */
tbody td:nth-child(3),
tbody td:nth-child(4) {
  font-size: 0.8rem;
  color: var(--fg-muted);
  min-width: 7rem;
}

/* Links */
a, a:visited {
  color: var(--blue);
  text-decoration: none;
}

a:hover { color: var(--cyan); text-decoration: underline; }

/* Parent directory link */
a[href="?C=N;O=D"],
a[href="../"],
a[href=".."] {
  color: var(--yellow);
}

/* Directory entries */
tbody tr td:nth-child(2) a[href$="/"] {
  color: var(--cyan);
}

tbody tr td:nth-child(2) a[href$="/"]:hover {
  color: var(--blue);
}

/* Sort arrows in header */
a img { vertical-align: middle; }

/* Footer */
#tn-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#tn-footer a {
  color: var(--purple);
}

#tn-footer a:hover {
  color: var(--cyan);
}

/* Horizontal rule Apache inserts */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* Address/server tag Apache appends */
address {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 1.5rem;
  font-style: normal;
}

/* Heading */
h1 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--blue);
  padding: 1.5rem 0 1rem;
}

/* Parent directory link */
a[href="../"] {
  color: var(--yellow);
}
