@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #12181A;
  --panel: #1B2426;
  --panel-raised: #212C2E;
  --paper: #EAE6DA;
  --brass: #B08D57;
  --brass-bright: #C9A876;
  --moss: #7A8B6F;
  --rust: #B3543B;
  --text: #E8E4D9;
  --text-dim: #9AA39C;
  --rule: #2C3A3C;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--brass-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

header.site-header {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
}

header.site-header .mark {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}

header.site-header h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 2.4rem;
  line-height: 1.15;
  margin: 0;
  color: var(--text);
}

header.site-header .sub {
  color: var(--text-dim);
  margin-top: 10px;
  font-size: 0.98rem;
  max-width: 46ch;
}

/* ---- File manifest list ---- */
.manifest { border-top: 1px solid var(--rule); }

.file-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.file-row .info { min-width: 0; }

.file-row .name {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  color: var(--text);
  word-break: break-word;
}

.file-row .desc {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-top: 6px;
  max-width: 52ch;
}

.file-row .meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--moss);
  margin-top: 10px;
  letter-spacing: 0.01em;
}

.file-row .meta span + span::before { content: "  ·  "; color: var(--rule); }

.btn {
  display: inline-block;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-brass { background: var(--brass); color: #17110A; }
.btn-brass:hover { background: var(--brass-bright); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--rule); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); text-decoration: none; }

.btn-rust { background: transparent; color: var(--rust); border-color: var(--rust); }
.btn-rust:hover { background: var(--rust); color: var(--ink); text-decoration: none; }

.empty-state {
  padding: 48px 0;
  color: var(--text-dim);
  border-bottom: 1px solid var(--rule);
}
.empty-state .headline { font-family: 'Fraunces', serif; font-size: 1.3rem; color: var(--text); margin-bottom: 8px; }

footer.site-footer {
  padding: 40px 0 60px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* ---- Auth card (login) ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--paper);
  color: #241E14;
  width: 100%;
  max-width: 380px;
  padding: 40px 36px;
  border-radius: var(--radius);
}

.auth-card .mark {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #6B5F45;
  margin: 0 0 8px;
}

.auth-card h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.6rem;
  margin: 0 0 24px;
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: #4A4230;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #C9BFA0;
  border-radius: var(--radius);
  background: #FFFDF8;
  font-size: 0.95rem;
  font-family: 'IBM Plex Sans', sans-serif;
}

.field input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }

.auth-card .btn-brass { width: 100%; padding: 12px; font-size: 0.9rem; }

.form-error {
  background: #F4E3DC;
  color: #7A3120;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.back-link { margin-top: 20px; }
.back-link a { color: var(--text-dim); font-size: 0.85rem; }

/* ---- Admin dashboard ---- */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 32px;
}
.admin-topbar h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.7rem;
  margin: 0;
}
.admin-topbar form { margin: 0; }

.upload-panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 44px;
}

.upload-panel h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0 0 18px;
}

.upload-panel .field label {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}

.upload-panel input[type="text"],
.upload-panel input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--ink);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
}

.upload-panel .hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.row-actions { display: flex; gap: 8px; flex-shrink: 0; }

.link-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.link-input {
  flex: 1 1 260px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--ink);
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
}
.link-input:focus-visible { outline: 2px solid var(--brass-bright); outline-offset: 1px; }

.edit-form {
  display: none;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.edit-form.open { display: flex; }
.edit-form input[type="text"] {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--ink);
  color: var(--text);
  font-size: 0.85rem;
  flex: 1 1 200px;
}

@media (max-width: 560px) {
  .file-row { flex-direction: column; }
  .row-actions { width: 100%; }
  header.site-header h1 { font-size: 1.9rem; }
}
