:root {
  --paper: #faf6ec;
  --ink: #24211b;
  --ink-soft: #57503f;
  --rule: #c9bfa4;
  --accent: #8a3324;
  --accent-soft: #f1e3d3;
  --badge: #2f5233;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  line-height: 1.6;
  /* Header/nav/banner/footer stay put; only .scroll-area scrolls. */
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

a { color: var(--accent); }
a:hover { color: var(--ink); }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header / masthead */
header.masthead {
  border-bottom: 3px double var(--ink);
  background: var(--paper);
  padding: 1.75rem 0 1rem;
  flex: 0 0 auto;
}

header.masthead .masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.masthead-badges {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sitehealth-badge {
  display: inline-flex;
  line-height: 0;
}

.sitehealth-badge img {
  display: block;
}

.site-title {
  font-family: "Playfair Display", "Iowan Old Style", Georgia, serif;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  margin: 0;
}
.site-title a { color: var(--ink); text-decoration: none; }
.site-tagline {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
}

nav.primary-nav {
  border-bottom: 1px solid var(--rule);
  background: var(--accent-soft);
  flex: 0 0 auto;
}
nav.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0.6rem 0;
  font-variant: small-caps;
  letter-spacing: 0.04em;
}
nav.primary-nav a { text-decoration: none; color: var(--ink); }
nav.primary-nav a:hover { color: var(--accent); }

/* Flagged-count badge on the "Staff Dashboard" link, so staff see it's
   waiting on them from anywhere on the public site, not just /dashboard/. */
.flag-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant: normal;
  padding: 0.05rem 0.4rem;
  margin-left: 0.3rem;
  vertical-align: 1px;
}

/* Logout is a POST form (GET logout isn't allowed), styled to read as a
   plain nav link rather than a button. */
.nav-logout-form { display: inline; margin: 0; }
.nav-logout-form button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-variant: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.nav-logout-form button:hover { background: none; color: var(--accent); }

/* Satire banner — appears on every paper page */
.satire-banner {
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}
.satire-banner strong { text-transform: uppercase; }

/* Only this area scrolls — header/nav/banner/footer stay fixed on screen. */
main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2.5rem 0 3rem;
}

.messages { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.messages li {
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--badge);
  background: var(--accent-soft);
  margin-bottom: 0.5rem;
}
.messages li.error { border-color: var(--accent); }

/* Journal / peer-review styling */
.journal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 2px solid var(--badge);
  color: var(--badge);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  transform: rotate(-2deg);
  /* It's a <button> so it can open the Bubba modal, but should still read
     as the same pill badge, not a form control. */
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.journal-badge:hover { background: var(--badge); color: #fff; }

/* Bubba modal */
.bubba-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 33, 27, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}
.bubba-overlay[hidden] { display: none; }
.bubba-modal {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  max-width: 420px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0.35rem 0.35rem 0 var(--rule);
}
.bubba-modal h2 {
  margin-top: 0;
  font-family: "Playfair Display", "Iowan Old Style", Georgia, serif;
  font-size: 1.4rem;
}
.bubba-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.25rem;
}
.bubba-close:hover { color: var(--accent); background: none; }

.paper-card {
  border: 1px solid var(--rule);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
}
.paper-card h3 { margin: 0.2rem 0 0.4rem; }
.paper-card .byline { color: var(--ink-soft); font-style: italic; margin: 0 0 0.5rem; }

.bubba-signature {
  font-style: italic;
  color: var(--ink-soft);
  text-align: right;
  margin: 0.25rem 0 0;
}

.paper-header {
  text-align: center;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
.paper-header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.paper-header .byline { font-style: italic; color: var(--ink-soft); }
.paper-header .affiliation { color: var(--ink-soft); font-size: 0.9rem; }

.paper-section { margin-bottom: 1.75rem; }
.paper-section h2 {
  font-variant: small-caps;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.25rem;
}
.references-list { padding-left: 1.25rem; }
.references-list li { margin-bottom: 0.4rem; }

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-variant: small-caps;
}
.status-approved { background: #e2ede2; color: var(--badge); }
.status-pending { background: #f0ead9; color: #7a6a3a; }
.status-flagged { background: #f6ded4; color: var(--accent); }
.status-rejected { background: #efdada; color: #7a2c22; }
.status-pulled { background: #e6e2d8; color: var(--ink-soft); }

.settings-section { margin-bottom: 2rem; }
.settings-section h2 {
  font-variant: small-caps;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.25rem;
}

form p { margin-bottom: 1rem; }
label { display: block; font-weight: bold; margin-bottom: 0.25rem; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
}
button, .btn {
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--ink); }
.helptext { color: var(--ink-soft); font-size: 0.85rem; }
ul.errorlist { color: var(--accent); padding-left: 1.1rem; }

/* Footer — persistent disclaimer on every page, kept compact since it's
   always on screen rather than at the bottom of a long scroll. */
footer.site-footer {
  border-top: 2px solid var(--ink);
  padding: 0.5rem 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
  background: var(--paper);
  flex: 0 0 auto;
}
footer.site-footer .disclaimer {
  max-width: 640px;
  margin: 0 auto;
  font-weight: bold;
  line-height: 1.3;
}
footer.site-footer .footer-meta {
  margin: 0.2rem 0 0;
}
footer.site-footer .footer-meta a { color: var(--ink-soft); margin: 0 0.4rem; }
