/* nedsferatu.com: a fan-site shell (black page, bevelled buttons, stamps, marquee) around
   an Apache-style directory index (monospace table: Name, Last modified, Size, Description). */

:root {
  --bg: #000;
  --panel: #0b0b0b;
  --inset: #050505;
  --text: #f2f2f2;
  --dim: #b5b5b5;
  --link: #00ffff;
  --visited: #ff66ff;
  --border: #fff;
  --rule: #444;
  --accent: #ff2a2a;
  --hi: #ffff66;
  --mono: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

a { color: var(--link); }
a:visited { color: var(--visited); }
a:focus-visible, button:focus-visible { outline: 2px dashed var(--hi); outline-offset: 2px; }

/* --- Top bar: name + marquee --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
}

.brand {
  flex: none;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
}
.brand:visited { color: var(--text); }
.brand-mark { color: var(--accent); }

.marquee {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid var(--rule);
  background: var(--inset);
  padding: 4px 0;
  font-size: 13px;
  color: var(--hi);
}
.marquee span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 14s linear infinite;
}
@keyframes marquee { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee span { animation: none; padding-left: 8px; }
}

/* --- Layout: rail + index --- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 12px 30px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.rail, .main {
  border: 2px solid var(--border);
  background: var(--panel);
  padding: 10px;
}

/* --- Rail panels --- */
.panel {
  border: 1px dashed var(--border);
  background: var(--inset);
  padding: 10px;
  margin-bottom: 12px;
}
.panel h2 {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: 1px;
}
.panel .geo-title {
  color: var(--accent);
  font-size: 18px;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
}

.stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  margin: 0;
  font-size: 13px;
}
.stats dt { color: var(--dim); }
.stats dd { margin: 0; overflow-wrap: anywhere; }

.counter {
  font-family: var(--mono);
  letter-spacing: 2px;
  padding: 1px 4px;
  border: 1px solid var(--border);
  background: #000;
  color: #39ff14;
}

/* Filter buttons: bevelled; the pressed one looks pushed in */
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.filter {
  font: inherit;
  font-size: 13px;
  color: var(--link);
  background: #141414;
  padding: 6px 4px;
  cursor: pointer;
  border: 2px solid;
  border-color: #777 #111 #111 #777;
}
.filter:hover { color: var(--hi); }
.filter[aria-pressed="true"] {
  color: #000;
  background: var(--link);
  border-color: #111 #777 #777 #111;
  font-weight: bold;
}

.news, .link-dump { margin: 0; padding-left: 18px; font-size: 13px; }
.news li, .link-dump li { margin-bottom: 4px; }
.news .date { color: var(--accent); font-weight: bold; font-family: var(--mono); }

.readme {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--dim);
}

.stamp-row { display: flex; flex-wrap: wrap; gap: 6px; }
.stamp {
  border: 1px solid var(--border);
  padding: 3px 6px;
  font-size: 11px;
  background: var(--inset);
}

/* --- The index --- */
.main { font-family: var(--mono); font-size: 14px; }

.index-title {
  margin: 0 0 10px;
  font-size: 20px;
}

.index {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.index .c-name { width: 40%; }
.index .c-date { width: 11.5em; }
.index .c-size { width: 5.5em; text-align: right; }

.index th, .index td {
  padding: 5px 8px;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index th.c-size, .index td.c-size { text-align: right; }

.index thead th {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.index th button {
  font: inherit;
  font-weight: bold;
  color: var(--link);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.index th[aria-sort="ascending"] button::after { content: " ^"; color: var(--hi); }
.index th[aria-sort="descending"] button::after { content: " v"; color: var(--hi); }

.index tbody tr { border-bottom: 1px dotted var(--rule); }
.index tbody tr:nth-child(even) { background: #070707; }
.index tbody tr:hover { background: #161616; }

.name-wrap { display: flex; align-items: baseline; gap: 0.6ch; min-width: 0; }
.icon, .new, .thumb-link { flex: none; }
.name-wrap:has(.thumb) { align-items: center; }
.thumb {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: #000;
  image-rendering: auto;
}
.thumb-link:hover .thumb { border-color: var(--link); }
.icon { color: var(--dim); }
.f-link {
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.f-link:hover { text-decoration: underline; }
.index td.c-desc { color: var(--dim); white-space: normal; } /* wraps: credits run long */

.new {
  color: var(--accent);
  font-weight: bold;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  border: 1px solid var(--accent);
  padding: 0 3px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .new { animation: none; } }

.empty { color: var(--dim); }

.rule { border: 0; border-top: 1px solid var(--rule); margin: 14px 0 8px; }
.serverline { font-style: italic; font-size: 12px; color: var(--dim); }

.site-footer {
  max-width: 1200px;
  margin: 0 auto 30px;
  padding: 10px 12px 0;
  border-top: 2px solid var(--border);
  font-size: 12px;
}

/* --- Narrow screens: rail on top, each file a two-line card --- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .marquee { flex-basis: 100%; }
  .page { grid-template-columns: 1fr; }
  /* Filters, then the files, then the rest of the rail. */
  .rail { display: contents; }
  .rail > * { margin-bottom: 0; }
  .panel-filters { order: -2; }
  .main { order: -1; }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .index .c-name, .index .c-date, .index .c-size { width: auto; }

  .index, .index thead, .index tbody, .index tr { display: block; width: 100%; }
  .index thead tr { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 0; }
  .index thead th { border: 0; padding: 0; width: auto; }
  .index thead { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 4px; }

  .index tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "name name" "date size" "desc desc";
    padding: 6px 0;
  }
  .index td { padding: 1px 4px; width: auto; }
  .index td.c-name { grid-area: name; }
  .index td.c-name .f-link { white-space: normal; overflow-wrap: anywhere; }
  .index td.c-date { grid-area: date; color: var(--dim); font-size: 12px; }
  .index td.c-size { grid-area: size; color: var(--dim); font-size: 12px; }
  .index td.c-desc { grid-area: desc; white-space: normal; font-size: 12px; }
}
