:root {
  --brand: #0b5428;
  --navy: var(--brand);
  --ink: #193b26;
  --muted: #5c7062;
  --line: #dce8df;
  --teal: var(--brand);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f7faf8;
  color: var(--ink);
  font:
    15px/1.6 system-ui,
    -apple-system,
    sans-serif;
}
header {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(5%, calc((100% - 1200px) / 2));
  background: white;
  border-bottom: 1px solid var(--line);
  gap: 30px;
}
.brand {
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -1.4px;
  text-decoration: none;
  color: var(--navy);
  line-height: 1.1;
}
.brand span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 7px;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 35px;
}
a {
  color: var(--teal);
}
nav a,
.adminlink {
  font-size: 13px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
main {
  max-width: 1120px;
  margin: auto;
  padding: 0 24px 60px;
}
.hero {
  padding: 64px 0 31px;
  max-width: 740px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 750;
  color: var(--teal);
}
h1 {
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.12;
  letter-spacing: -2px;
  font-weight: 650;
  margin: 20px 0;
}
h1 em {
  font-style: normal;
  color: var(--teal);
}
.hero p {
  font-size: 17px;
  max-width: 600px;
  color: var(--muted);
}
.small {
  padding-top: 35px;
}
.searchpanel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 28px #0b542806;
}
.searchbox {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid #a8bfae;
  border-radius: 7px;
  padding: 7px 8px 7px 18px;
}
.searchbox > span {
  font-size: 30px;
}
.searchbox input {
  border: 0;
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  font-size: 16px;
}
.searchbox input:focus {
  outline: none;
}
.searchbox:focus-within {
  outline: 2px solid var(--teal);
}
button,
.upload {
  cursor: pointer;
  border: 0;
  background: var(--navy);
  color: white;
  padding: 12px 22px;
  border-radius: 5px;
  font: 600 13px system-ui;
  min-height: 44px;
}
button:hover {
  filter: brightness(1.15);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.branches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}
.branches button {
  background: #f1f6f2;
  color: #455f4d;
  padding: 8px 14px;
  font-size: 12px;
  border: 1px solid transparent;
  min-height: 38px;
}
.branches button.active {
  background: #e7f3ea;
  border-color: #82b38e;
  color: var(--brand);
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.options {
  font-size: 11px;
  color: var(--muted);
  margin: 19px 0 0;
  flex-wrap: wrap;
}
input[type="checkbox"] {
  accent-color: var(--teal);
}
.examples {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.examples > span {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
}
.examples button {
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 5px;
  min-height: 36px;
}
.ad {
  margin: 26px 0;
  border: 1px dashed #d5e3d9;
  background: #f1f6f2;
  text-align: center;
  padding: 12px;
  color: #647b6b;
}
.ad span {
  font-size: 9px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}
.ad p {
  font-size: 11px;
  margin: 5px;
}
.empty {
  text-align: center;
  padding: 46px 15px 54px;
}
.icon {
  font-size: 30px;
  color: #578466;
}
.empty h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 14px;
}
.empty p {
  color: var(--muted);
  font-size: 14px;
}
.empty a {
  font-size: 12px;
  font-weight: 700;
}
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 35px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.features span {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--teal);
  font-weight: 700;
}
.features h3 {
  font-size: 16px;
  margin: 10px 0;
}
.features p {
  font-size: 12px;
  color: var(--muted);
}
footer {
  background: white;
  border-top: 1px solid var(--line);
  padding: 26px max(5%, calc((100% - 1120px) / 2));
  display: flex;
  gap: 32px;
  align-items: center;
}
footer strong {
  font-size: 20px;
  letter-spacing: -1px;
}
footer p {
  max-width: 720px;
  font-size: 10px;
  color: var(--muted);
}
footer a {
  font-size: 10px;
  white-space: nowrap;
}
.panel,
.result {
  background: white;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 20px 0;
}
h2 {
  font-size: 21px;
}
h3 {
  font-size: 17px;
}
.panel p,
.result p {
  color: var(--muted);
}
label {
  display: inline-block;
}
input:not([type="checkbox"]):not([type="file"]),
select,
textarea {
  font: inherit;
  color: var(--ink);
  border: 1px solid #b8ccbe;
  border-radius: 4px;
  padding: 10px;
  max-width: 100%;
  background: white;
}
#loginform input {
  display: block;
  margin: 8px 15px 10px 0;
}
input[type="file"] {
  display: block;
  font-size: 11px;
  margin-top: 10px;
  max-width: 100%;
}
.upload {
  display: inline-block;
  margin: 10px 10px 10px 0;
}
.checks {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.checks label {
  font-size: 12px;
}
.secondary {
  background: #eaf3ec;
  color: var(--ink);
}
.filters,
.metadata {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.metadata label {
  font-size: 12px;
}
.metadata input,
.metadata select {
  display: block;
  width: 100%;
}
.metadata textarea {
  width: 100%;
}
blockquote {
  margin: 15px 0;
  padding: 15px 20px;
  border-left: 3px solid var(--teal);
  background: #f3f8f4;
  white-space: pre-wrap;
  font-size: 14px;
}
small,
.badge {
  color: var(--muted);
  font-size: 11px;
}
.badge {
  padding: 3px 7px;
  background: #edf5ef;
  border-radius: 4px;
}
dialog {
  max-width: 850px;
  width: 95%;
  max-height: 85vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 25px;
}
dialog::backdrop {
  background: #143b2388;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
progress {
  width: 100%;
}
[hidden] {
  display: none !important;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #2e8544;
  outline-offset: 3px;
}
@media (max-width: 650px) {
  header {
    height: auto;
    min-height: 95px;
    flex-wrap: wrap;
    padding: 18px 20px;
    gap: 16px;
  }
  .brand {
    font-size: 26px;
  }
  nav {
    order: 3;
    width: 100%;
    gap: 26px;
  }
  nav a {
    font-size: 12px;
  }
  .adminlink {
    margin-left: auto;
  }
  main {
    padding: 0 16px 35px;
  }
  .hero {
    padding-top: 38px;
  }
  .hero p {
    font-size: 15px;
  }
  .searchpanel {
    padding: 14px;
  }
  .searchbox {
    gap: 8px;
    padding-left: 9px;
  }
  .searchbox > span {
    display: none;
  }
  .searchbox input {
    font-size: 13px;
  }
  .searchbox button {
    padding: 12px;
  }
  .branches {
    gap: 6px;
  }
  .branches button {
    padding: 7px 10px;
  }
  .features {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .features p {
    margin-top: 4px;
  }
  .features h3 {
    margin: 5px 0;
  }
  footer {
    flex-wrap: wrap;
    gap: 8px;
    padding: 22px;
  }
  .filters,
  .metadata {
    grid-template-columns: 1fr;
  }
  .empty br {
    display: none;
  }
  .panel {
    padding: 16px;
  }
}
.searchbox input#question {
  border: 0;
  padding: 10px 0;
  border-radius: 0;
  background: transparent;
}

.searchmodes { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 18px; }
.searchmodes label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; }
.searchmodes input { width: auto; margin: 0; accent-color: var(--brand); }

/* Persistent side navigation, with a collapsible drawer on phones. */
body { padding-left: 240px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: white; border-right: 1px solid var(--line); padding: 36px 20px; display: flex; flex-direction: column; gap: 36px; overflow-y: auto; z-index: 1002; }
.sidebar .brand { font-size: 28px; }
.sidebar .brand span { font-size: 9px; letter-spacing: .8px; }
.sidebar nav { display: flex; flex-direction: column; width: 100%; gap: 8px; order: initial; }
.sidebar nav a, .sidebar .adminlink { padding: 12px; border-radius: 8px; font-size: 14px; }
.sidebar a[aria-current="page"] { color: var(--teal); background: #e8f4eb; }
.sidebar nav a:hover { background: #f0f7f2; }
.sidebar .adminlink { margin: auto 0 0; }
.menu-toggle { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #143b2377; z-index: 1001; }
@media (max-width: 760px) {
  body { padding-left: 0; padding-top: 64px; }
  .menu-toggle { display: block; position: fixed; top: 12px; left: 16px; z-index: 1003; padding: 9px 14px; }
  .sidebar { width: min(280px, 85vw); padding-top: 78px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.is-open { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

.analytics-consent { position: fixed; bottom: 16px; left: 256px; right: 16px; max-width: 640px; margin-left: auto; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 24px #0b542826; z-index: 1000; }
.analytics-consent p { margin: 0 0 12px; }
@media (max-width: 760px) { .analytics-consent { left: 16px; } }

.social-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.google-signin { background: white; color: #183347; border: 1px solid #627582; }
.apple-signin { background: #111; color: white; }
#legacy-signin > summary { cursor: pointer; margin: 18px 0; }

.order-reader { width: 100%; height: min(80vh, 960px); min-height: 420px; border: 1px solid var(--line); border-radius: 10px; background: white; }
#readerpagetext { white-space: pre-wrap; overflow-wrap: anywhere; }
#readerpage { max-width: 110px; }
#mysaveditems .panel { margin-bottom: 18px; }

#mysaveditems p, #mysaveditems h2, #readerstatus { overflow-wrap: anywhere; }

#aimembership { max-width: 540px; width: calc(100% - 32px); }
#aimembership .row { flex-wrap: wrap; }

body.results-view main > .hero,
body.results-view main > .searchpanel,
body.results-view main > .features,
body.results-view main > #empty,
body.results-view main > .ad { display: none; }
body.search-home #results { display: none; }

.hero.home-logo { width: 100%; max-width: none; padding: 20px 0; margin: 0 auto 24px; background: #fff; border-radius: 12px; }
.home-logo img { display: block; width: min(440px, 100%); height: 120px; object-fit: cover; margin: 0 auto; }
.search-publication { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 18px; }
