/* ===================================================================
   The Institute for Interdisciplinary Inquiry
   Research Archives — Catalog Access Portal
   Stylesheet v2.1 — Last revised: September 1997
   =================================================================== */

/* --- Reset & Base --- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream:       #FFFDF5;
  --navy:        #1B2A4A;
  --tan-accent:  #8B7355;
  --tan-border:  #D4C5A9;
  --brown-head:  #3D1C00;
  --rule-color:  #B5A48A;
  --link-color:  #1A3A7A;
  --link-visited:#5C2D8A;
  --input-bg:    #FDFAF2;
  --shadow-light:#C8B89A;
}

html {
  font-size: 16px;
  background-color: var(--cream);
  color: var(--navy);
}

body {
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.65;
  background-color: var(--cream);
  color: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Typography --- */

h1, h2, h3, h4, h5, h6 {
  font-family: Georgia, "Times New Roman", Times, serif;
  color: var(--brown-head);
  line-height: 1.3;
}

h1 { font-size: 1.6rem; font-weight: bold; }
h2 { font-size: 1.35rem; font-weight: bold; margin-bottom: 0.5rem; }
h3 { font-size: 1.1rem; font-weight: bold; }

p { margin-bottom: 1rem; }

a {
  color: var(--link-color);
  text-decoration: underline;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  color: var(--brown-head);
  text-decoration: underline;
}

abbr {
  cursor: help;
  border-bottom: 1px dotted var(--tan-accent);
  text-decoration: none;
}

/* --- Layout Wrapper --- */

.page-wrapper {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  flex: 1;
}

/* --- Site Header --- */

.site-header {
  background-color: var(--cream);
  border-bottom: 3px double var(--tan-border);
  padding: 1.5rem 0 1.2rem;
  margin-bottom: 0;
}

.site-header .page-wrapper {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-crest {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
}

.header-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.header-text {
  flex: 1;
}

.institution-name {
  font-variant: small-caps;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--brown-head);
  letter-spacing: 0.04em;
  line-height: 1.2;
  display: block;
  text-decoration: none;
}

.institution-name:hover {
  color: var(--navy);
  text-decoration: none;
}

.institution-name:visited {
  color: var(--brown-head);
}

.institution-subtitle {
  font-size: 0.82rem;
  color: var(--tan-accent);
  font-style: italic;
  margin-top: 0.2rem;
  display: block;
  letter-spacing: 0.01em;
}

/* --- Header Nav Bar --- */

.header-nav {
  background-color: #EDE8DC;
  border-bottom: 2px solid var(--tan-border);
  padding: 0.35rem 0;
  font-size: 0.83rem;
}

.header-nav .page-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-nav a {
  color: var(--navy);
  text-decoration: none;
  padding: 0.2rem 0.75rem;
  border-right: 1px solid var(--tan-border);
  display: inline-block;
}

.header-nav a:first-child {
  padding-left: 0;
}

.header-nav a:hover {
  color: var(--brown-head);
  text-decoration: underline;
}

/* --- Main Content Area --- */

.main-content {
  padding: 2rem 0 3rem;
}

/* --- Section headings / page titles --- */

.page-title {
  font-size: 1.25rem;
  color: var(--brown-head);
  border-bottom: 1px solid var(--rule-color);
  padding-bottom: 0.4rem;
  margin-bottom: 1.5rem;
}

.section-rule {
  border: none;
  border-top: 1px solid var(--rule-color);
  margin: 1.5rem 0;
}

.section-rule-double {
  border: none;
  border-top: 3px double var(--rule-color);
  margin: 2rem 0;
}

/* --- Search Section --- */

.search-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.search-section-title {
  font-size: 0.9rem;
  font-variant: small-caps;
  color: var(--tan-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-style: normal;
  margin-bottom: 0.75rem;
  display: block;
}

.search-form {
  display: flex;
  align-items: stretch;
  max-width: 580px;
  margin: 0 auto;
  gap: 0;
}

.search-input {
  flex: 1;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  background-color: var(--input-bg);
  color: var(--navy);
  border: 2px solid var(--tan-border);
  border-right: 1px solid var(--tan-border);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.08), inset -1px -1px 2px rgba(255,255,255,0.6);
  outline: none;
  min-width: 0;
}

.search-input:focus {
  border-color: var(--tan-accent);
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1), inset -1px -1px 2px rgba(255,255,255,0.5), 0 0 0 1px var(--tan-accent);
}

.search-input::placeholder {
  color: #A9957A;
  font-style: italic;
}

.search-submit {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.9rem;
  padding: 0.6rem 1.1rem;
  background-color: #E8E0D0;
  color: var(--brown-head);
  border: 2px solid var(--tan-border);
  border-left: 1px solid var(--tan-border);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 1px 1px 0 #FFF inset, -1px -1px 0 var(--shadow-light) inset;
  transition: background-color 0.1s;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  font-weight: bold;
}

.search-submit:hover {
  background-color: #DDD5C3;
}

.search-submit:active {
  box-shadow: 1px 1px 0 var(--shadow-light) inset, -1px -1px 0 #FFF inset;
  background-color: #D0C9B8;
}

.search-hint {
  font-size: 0.78rem;
  color: var(--tan-accent);
  margin-top: 0.5rem;
  font-style: italic;
  display: block;
}

/* --- Archive Intro Block --- */

.archive-intro {
  border: 1px solid var(--tan-border);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
  background-color: #FAF7EF;
  font-size: 0.88rem;
  line-height: 1.6;
}

.archive-intro p {
  margin-bottom: 0.5rem;
}

.archive-intro p:last-child {
  margin-bottom: 0;
}

/* --- Loading State --- */

.loading-state {
  display: none;
  text-align: center;
  padding: 2.5rem 0;
  color: var(--tan-accent);
  font-style: italic;
  font-size: 0.92rem;
}

.loading-state.is-active {
  display: block;
}

.loading-dots {
  display: inline-block;
  animation: loading-pulse 1.4s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.loading-message {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--tan-accent);
}

/* --- Results Area --- */

.results-area {
  display: none;
}

.results-area.is-active {
  display: block;
}

.results-header {
  font-size: 0.85rem;
  color: var(--tan-accent);
  border-bottom: 1px solid var(--rule-color);
  padding-bottom: 0.4rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.results-count {
  font-weight: bold;
  font-style: normal;
  color: var(--navy);
}

/* --- Paper Result Card (search results) --- */

.paper-card {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule-color);
}

.paper-card:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.paper-card-title {
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--link-color);
  margin-bottom: 0.25rem;
}

.paper-card-title a {
  color: inherit;
  text-decoration: none;
}

.paper-card-title a:hover {
  text-decoration: underline;
}

.paper-card-title a:visited {
  color: var(--link-visited);
}

.paper-card-authors {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

.paper-card-meta {
  font-size: 0.82rem;
  color: var(--tan-accent);
  font-family: "Courier New", Courier, monospace;
  margin-bottom: 0.6rem;
}

.paper-card-abstract {
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: justify;
  color: var(--navy);
  margin-bottom: 0;
}

/* --- Browse Page List --- */

.browse-section-title {
  font-size: 0.82rem;
  font-variant: small-caps;
  color: var(--tan-accent);
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--rule-color);
  padding-bottom: 0.3rem;
  margin-bottom: 1.5rem;
}

.browse-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.browse-entry {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--tan-border);
}

.browse-entry:first-child {
  padding-top: 0;
}

.browse-entry:last-child {
  border-bottom: none;
}

.browse-entry-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.browse-entry-title a {
  color: var(--link-color);
  text-decoration: none;
}

.browse-entry-title a:hover {
  text-decoration: underline;
}

.browse-entry-title a:visited {
  color: var(--link-visited);
}

.browse-entry-authors {
  font-style: italic;
  font-size: 0.88rem;
  color: var(--navy);
  margin-bottom: 0.15rem;
}

.browse-entry-meta {
  font-size: 0.8rem;
  color: var(--tan-accent);
  font-family: "Courier New", Courier, monospace;
  margin-bottom: 0.5rem;
}

.browse-entry-snippet {
  font-size: 0.88rem;
  color: #4A4035;
  line-height: 1.55;
}

/* --- Pagination --- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-color);
  font-size: 0.88rem;
}

.pagination-btn {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.88rem;
  padding: 0.3rem 0.7rem;
  background-color: #EDE8DC;
  color: var(--navy);
  border: 1px solid var(--tan-border);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 1px 1px 0 #FFF inset, -1px -1px 0 var(--shadow-light) inset;
}

.pagination-btn:hover {
  background-color: #DDD5C3;
  color: var(--brown-head);
  text-decoration: none;
}

.pagination-btn:active {
  box-shadow: 1px 1px 0 var(--shadow-light) inset, -1px -1px 0 #FFF inset;
}

.pagination-btn.is-current {
  background-color: #D0C9B8;
  font-weight: bold;
  color: var(--brown-head);
  cursor: default;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.15);
}

.pagination-btn:disabled,
.pagination-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--tan-accent);
  font-style: italic;
  font-size: 0.82rem;
  margin: 0 0.75rem;
}

/* --- Full Paper View (paper.html) --- */

.paper-full {
  padding: 0;
}

.paper-full-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--brown-head);
  line-height: 1.25;
  margin-bottom: 0.6rem;
}

.paper-full-authors {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.paper-full-meta {
  font-size: 0.84rem;
  color: var(--tan-accent);
  font-family: "Courier New", Courier, monospace;
  margin-bottom: 1.2rem;
}

.paper-abstract-heading,
.paper-section-heading {
  font-size: 0.82rem;
  font-variant: small-caps;
  color: var(--tan-accent);
  letter-spacing: 0.08em;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--tan-border);
  padding-bottom: 0.2rem;
}

.paper-abstract-text {
  font-size: 0.92rem;
  line-height: 1.7;
  text-align: justify;
  color: var(--navy);
}

.paper-findings {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: findings-counter;
}

.paper-findings li {
  counter-increment: findings-counter;
  font-size: 0.9rem;
  line-height: 1.65;
  padding-left: 2.2rem;
  position: relative;
  margin-bottom: 0.6rem;
  text-align: justify;
}

.paper-findings li::before {
  content: counter(findings-counter) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--tan-accent);
  font-weight: bold;
  min-width: 1.8rem;
}

.paper-citations {
  list-style: none;
  padding: 0;
  margin: 0;
}

.paper-citations li {
  font-size: 0.85rem;
  line-height: 1.55;
  padding-left: 2rem;
  text-indent: -2rem;
  margin-bottom: 0.55rem;
  color: var(--navy);
}

.paper-further-reading {
  list-style: none;
  padding: 0;
  margin: 0;
}

.paper-further-reading li {
  font-size: 0.85rem;
  line-height: 1.55;
  padding-left: 2rem;
  text-indent: -2rem;
  margin-bottom: 0.5rem;
  color: var(--navy);
}

/* --- Action Buttons (Cite / Share) --- */

.paper-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule-color);
  flex-wrap: wrap;
}

.action-btn {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.88rem;
  padding: 0.45rem 1rem;
  background-color: #EDE8DC;
  color: var(--navy);
  border: 1px solid var(--tan-border);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 1px 1px 0 #FFF inset, -1px -1px 0 var(--shadow-light) inset;
  transition: background-color 0.1s;
}

.action-btn:hover {
  background-color: #DDD5C3;
  color: var(--brown-head);
  text-decoration: none;
}

.action-btn:active {
  box-shadow: 1px 1px 0 var(--shadow-light) inset, -1px -1px 0 #FFF inset;
  background-color: #D0C9B8;
}

.action-btn--primary {
  background-color: #D8CFC0;
  font-weight: bold;
}

.copy-confirm {
  display: none;
  font-size: 0.8rem;
  color: var(--tan-accent);
  font-style: italic;
}

.copy-confirm.is-visible {
  display: inline;
}

/* --- Error / Not Found State --- */

.error-state {
  display: none;
  padding: 2rem 0;
  border-top: 1px solid var(--rule-color);
}

.error-state.is-active {
  display: block;
}

.error-state-heading {
  font-size: 1rem;
  font-weight: bold;
  color: var(--brown-head);
  margin-bottom: 0.75rem;
}

.error-state-body {
  font-size: 0.9rem;
  line-height: 1.65;
}

.error-state-code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  color: var(--tan-accent);
  display: block;
  margin-top: 1rem;
}

/* --- Navigation breadcrumb --- */

.breadcrumb {
  font-size: 0.82rem;
  color: var(--tan-accent);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--tan-accent);
}

.breadcrumb a:hover {
  color: var(--brown-head);
}

.breadcrumb-sep {
  margin: 0 0.4rem;
  color: var(--rule-color);
}

/* --- "Browse the Literature" link / back links --- */

.archive-link {
  font-size: 0.88rem;
  display: inline-block;
  margin-top: 0.5rem;
}

/* --- Footer --- */

.site-footer {
  background-color: #EDE8DC;
  border-top: 3px double var(--tan-border);
  padding: 1.2rem 0;
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--tan-accent);
  text-align: center;
  line-height: 1.7;
}

.site-footer .page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.site-footer a {
  color: var(--tan-accent);
}

.site-footer a:hover {
  color: var(--brown-head);
}

.footer-rule {
  border: none;
  border-top: 1px solid var(--rule-color);
  margin: 0.6rem 0;
  width: 60%;
}

/* --- Utility --- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-muted {
  color: var(--tan-accent);
  font-style: italic;
  font-size: 0.88rem;
}

.no-results {
  font-style: italic;
  color: var(--tan-accent);
  padding: 1.5rem 0;
  font-size: 0.92rem;
}

/* ===================================================================
   Responsive
   =================================================================== */

@media (max-width: 640px) {
  .page-wrapper {
    padding: 0 1.1rem;
  }

  .site-header .page-wrapper {
    gap: 0.9rem;
  }

  .header-crest {
    width: 52px;
    height: 52px;
  }

  .institution-name {
    font-size: 1.05rem;
  }

  .search-form {
    flex-direction: column;
  }

  .search-input {
    border-right: 2px solid var(--tan-border);
    border-bottom: 1px solid var(--tan-border);
    width: 100%;
  }

  .search-submit {
    border-left: 2px solid var(--tan-border);
    border-top: 1px solid var(--tan-border);
    width: 100%;
    text-align: center;
  }

  .paper-full-title {
    font-size: 1.15rem;
  }

  .paper-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-nav a {
    padding: 0.2rem 0.5rem;
  }
}

@media (max-width: 400px) {
  .institution-name {
    font-size: 0.95rem;
  }

  .header-crest {
    width: 42px;
    height: 42px;
  }
}
