:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #595959;
  --rule: #d9d9d9;
  --rule-dark: #222222;
  --soft: #f7f7f7;
  --note: #fff8df;
  --error: #9b1c1c;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

.page {
  width: min(820px, calc(100% - 36px));
  margin: 0 auto;
  padding: 54px 0 64px;
}

.masthead {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule-dark);
  text-align: left;
}

.brand-logo {
  display: block;
  width: min(300px, 78vw);
  height: auto;
  margin: 0 0 34px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3.1rem, 8vw, 5.9rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.48;
}

.admin-warning {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--rule-dark);
  background: var(--note);
  color: var(--ink);
  font-size: 0.95rem;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  margin: 30px 0 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.search-wrap,
.upload-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="search"],
input[type="text"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--rule-dark);
  border-radius: 0;
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

input[type="search"],
input[type="text"] {
  padding: 11px 12px;
}

input[type="file"] {
  padding: 9px;
}

input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.plain-button,
.open-link,
.delete-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-dark);
  border-radius: 0;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  cursor: pointer;
}

.plain-button:hover,
.open-link:hover,
.delete-link:hover {
  background: var(--ink);
  color: var(--paper);
}

.primary {
  background: var(--ink);
  color: var(--paper);
}

.primary:hover {
  background: var(--paper);
  color: var(--ink);
}

.status {
  margin: 18px 0;
  color: var(--muted);
  font-size: 1rem;
}

.status.error {
  color: var(--error);
}

.library {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule-dark);
}

.research-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.research-card h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 400;
  line-height: 1.2;
}

.filename {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  white-space: nowrap;
}

.delete-link {
  color: var(--error);
  border-color: var(--error);
}

.delete-link:hover {
  background: var(--error);
  color: var(--paper);
}

.upload-section {
  margin-top: 32px;
  padding: 18px;
  border: 1px solid var(--rule-dark);
  background: var(--soft);
}

.first-section {
  margin-top: 30px;
}

.section-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
  font-weight: 400;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.35;
}

.return-link {
  margin: 28px 0 0;
}

.return-link a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

.return-link a:hover {
  color: var(--muted);
  border-color: var(--muted);
}

.empty {
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 28px, 820px);
    padding-top: 32px;
  }

  .toolbar,
  .research-card,
  .field-grid,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }

  .card-actions {
    justify-content: stretch;
    white-space: normal;
  }

  .open-link,
  .delete-link,
  .plain-button {
    width: 100%;
  }
}
