/*
 * Stylesheet for Apache mod_autoindex directory listings under iptc.org/std/
 * (e.g. https://iptc.org/std/NewsML-G2/2.36/).
 *
 * Targets the markup Apache generates with "IndexOptions HTMLTable":
 *   h1#indextitle, table#indexlist, tr.indexhead, tr.indexbreakrow,
 *   td.indexcolicon / .indexcolname / .indexcollastmod / .indexcolsize / .indexcoldesc
 * plus whatever ReadmeName (README.html) appends after the table.
 */

:root {
  --text: #1f2328;
  --muted: #59636e;
  --link: #0b5cad;
  --border: #d8dee4;
  --row-alt: #f6f8fa;
  --row-hover: #eaf2fb;
  --bg: #ffffff;
  --code-bg: #f1f3f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6edf3;
    --muted: #9198a1;
    --link: #6cb6ff;
    --border: #30363d;
    --row-alt: #161b22;
    --row-hover: #1c2a3a;
    --bg: #0d1117;
    --code-bg: #1f242c;
  }
}

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

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

body {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

h1, h2, h3 { line-height: 1.25; margin: 2rem 0 0.75rem; font-weight: 600; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }

code {
  font: 0.875em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---- Listing title ---- */
#indextitle {
  margin-top: 0;
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}

/* ---- Listing table ---- */
#indexlist {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 2.5rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

#indexlist th,
#indexlist td {
  padding: 0.45rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

#indexlist .indexhead th {
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--row-alt);
}
#indexlist .indexhead a { color: var(--text); }

/* Apache inserts <tr class="indexbreakrow"><th><hr></th></tr>; the borders replace them */
#indexlist .indexbreakrow { display: none; }

#indexlist tr.odd td { background: var(--row-alt); }
#indexlist tr.even:hover td,
#indexlist tr.odd:hover td { background: var(--row-hover); }

#indexlist .indexcolicon { width: 1px; padding-right: 0; }
#indexlist .indexcolicon img { display: block; width: 20px; height: 22px; }
#indexlist .indexcolname { width: 100%; white-space: normal; overflow-wrap: anywhere; }
#indexlist .indexcollastmod { color: var(--muted); font-variant-numeric: tabular-nums; }
#indexlist .indexcolsize { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
#indexlist .indexhead .indexcolsize { text-align: right; }

/* The Description column is empty for every entry on iptc.org/std */
#indexlist .indexcoldesc { display: none; }

/* ---- README appended after the table ---- */
#indexlist + h1 {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* ---- Narrow screens: drop the date column, keep name and size ---- */
@media (max-width: 600px) {
  body { padding-top: 1.25rem; }
  #indextitle { font-size: 1.25rem; }
  #indexlist th, #indexlist td { padding: 0.45rem 0.5rem; }
  #indexlist .indexcollastmod { display: none; }
}

