/* PhilReviews — academic design */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Source Sans 3", "Source Sans Pro", sans-serif;
  background: #faf9f6;
  color: #222;
  line-height: 1.5;
}

/* ---------- Header ---------- */
.site-header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  border-bottom: 3px solid #1a3a5c;
}
.site-header h1 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 2.25rem;
  color: #1a3a5c;
  margin: 0 0 0.25rem;
}
.site-logo {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding-left: 40px;
}
.site-logo img {
  height: 44px;
  width: auto;
}
.site-header .tagline {
  color: #555;
  font-size: 1rem;
  margin: 0 0 0.5rem;
}
.site-header .meta {
  color: #8b6914;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- Container ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* ---------- Search panel ---------- */
.search-panel {
  background: #fff;
  border: 1px solid #e0dcd4;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.global-search {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.global-search input {
  flex: 1;
  font-size: 1rem;
  padding: 0.6rem 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
}
.global-search input:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}

/* ---------- Filter bar (always visible) ---------- */
.filter-bar {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.filter-bar-group {
  position: relative;
}
.filter-bar-group > label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Journal multi-select */
.journal-filter-wrap {
  min-width: 200px;
  flex: 1;
}
#journal-select-btn {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  text-align: left;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#journal-select-btn:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}
.journal-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 280px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  margin-top: 2px;
}
.journal-dropdown.open { display: block; }
.journal-dropdown-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #e0dcd4;
}
.journal-dropdown-actions button {
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: #555;
  font-family: inherit;
}
.journal-dropdown-actions button:hover {
  border-color: #999;
  color: #222;
}
.journal-dropdown-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.4rem 0;
}
.journal-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #333;
}
.journal-option:hover {
  background: #f5f2eb;
}
.journal-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* Year inputs */
.year-filter-wrap {
  min-width: 160px;
}
.year-inputs {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.year-inputs input {
  width: 80px;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}
.year-inputs input:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}
.year-dash {
  color: #999;
  font-size: 0.9rem;
}

/* Filter bar actions */
.filter-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-end;
  padding-bottom: 0.1rem;
}
#clear-filters {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #555;
  font-family: inherit;
  white-space: nowrap;
}
#clear-filters:hover {
  border-color: #999;
  color: #222;
}
.filter-indicator {
  font-size: 0.8rem;
  color: #8b6914;
  font-weight: 600;
}

/* ---------- Advanced filters ---------- */
#advanced-toggle {
  background: none;
  border: none;
  color: #1a3a5c;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}

.advanced-filters {
  display: none;
  padding-top: 1rem;
  border-top: 1px solid #e0dcd4;
  margin-top: 0.75rem;
}
.advanced-filters.open { display: block; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem 1rem;
}
.filter-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.filter-group input,
.filter-group select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}
.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}
.type-checkboxes {
  display: flex;
  gap: 1rem;
  padding-top: 0.35rem;
}
.type-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #222;
  cursor: pointer;
}
.type-checkboxes input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ---------- Results bar ---------- */
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
#result-count {
  font-size: 0.95rem;
  color: #555;
}
.share-btn.copied {
  background: #3a7d3a;
  border-color: #3a7d3a;
}
.per-page-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}
.per-page-wrap select {
  padding: 0.25rem 0.4rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: inherit;
}

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  background: #f0ece3;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a3a5c;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid #d5cfc3;
  white-space: nowrap;
  user-select: none;
}
th[data-sort] { cursor: pointer; transition: background-color 0.15s; }
th[data-sort]:hover { background-color: #e8dcd0; }
th[data-sort]::after {
  content: " \2195";
  font-size: 0.7em;
  opacity: 0.4;
}
th.sort-asc::after { content: " \2191"; opacity: 0.8; }
th.sort-desc::after { content: " \2193"; opacity: 0.8; }

tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #e8e4dc;
  vertical-align: top;
}

.review-row { cursor: pointer; }
.review-row:hover { background: #f5f2eb; }
.review-row.expanded { background: #f0ece3; }
.info-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  margin-left: 0.35rem;
  transition: border-color 0.15s, color 0.15s;
}
.info-btn:hover {
  border-color: #1a3a5c;
  color: #1a3a5c;
}
.review-row.expanded .info-btn {
  border-color: #8b6914;
  color: #8b6914;
}
.title-link {
  color: #1a3a5c;
  text-decoration: none;
}
.title-link:hover { text-decoration: underline; }
.name-link { cursor: pointer; text-decoration: none; color: inherit; }
.name-link:hover { text-decoration: underline; color: #1a3a5c; }

/* ---------- Detail row ---------- */
.detail-row td {
  padding: 0;
  border-bottom: 1px solid #e8e4dc;
}
.detail-content {
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  border-left: 3px solid #8b6914;
  background: #fdfcf9;
  font-size: 0.9rem;
  line-height: 1.6;
}
.detail-content .summary {
  margin: 0 0 0.5rem;
  color: #333;
}
.access-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge-open { background: #d4edda; color: #155724; }
.badge-restricted { background: #f8d7da; color: #721c24; }
.badge-symposium { background: #d1ecf1; color: #0c5460; }
.symposium-peers { margin-top: 0.5rem; font-size: 0.85rem; }
.symposium-peers ul { margin: 0.25rem 0 0 1.2rem; padding: 0; }
.symposium-peers li { margin-bottom: 0.2rem; }

/* Subfield badges */
.subfield-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  margin-right: 0.2rem;
}
.subfield-ethics { background: #d4edda; color: #155724; }
.subfield-applied-ethics { background: #c3e6cb; color: #155724; }
.subfield-political { background: #cce5ff; color: #004085; }
.subfield-legal { background: #b8daff; color: #004085; }
.subfield-epistemology { background: #e2d5f1; color: #3d1a78; }
.subfield-metaphysics { background: #d6ccf0; color: #3d1a78; }
.subfield-science { background: #fff3cd; color: #856404; }
.subfield-aesthetics { background: #fce4ec; color: #880e4f; }
.subfield-religion { background: #f5e6cc; color: #7a4f01; }
.subfield-history { background: #e8e4dc; color: #5d4e37; }
.subfield-ancient { background: #e0d8c8; color: #5d4e37; }
.subfield-modern { background: #d9ceb8; color: #5d4e37; }
.subfield-continental { background: #d1ecf1; color: #0c5460; }
.subfield-feminist { background: #f3d9fa; color: #6a1b9a; }
.subfield-non-western { background: #dcedc8; color: #33691e; }

/* Subfield filter dropdown */
.subfield-filter-wrap {
  min-width: 180px;
}
#subfield-select-btn {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  text-align: left;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#subfield-select-btn:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}

.read-link {
  color: #1a3a5c;
  font-weight: 600;
  text-decoration: none;
}
.read-link:hover { text-decoration: underline; }
.find-book-link {
  margin-left: 0.75rem;
  cursor: pointer;
}

/* ---------- Pagination ---------- */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 2rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  color: #333;
}
.page-btn:hover:not(:disabled):not(.active) {
  border-color: #1a3a5c;
  color: #1a3a5c;
}
.page-btn.active {
  background: #1a3a5c;
  color: #fff;
  border-color: #1a3a5c;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.page-ellipsis {
  padding: 0 0.3rem;
  color: #999;
}

/* ---------- Header link ---------- */
.site-header h1 a {
  color: inherit;
  text-decoration: none;
}
.site-header h1 a:hover {
  text-decoration: underline;
}

/* ---------- Loading indicator ---------- */
.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
}

/* ---------- Subscribe ---------- */
.subscribe-section {
  max-width: 540px;
  margin: 3rem auto 0;
  padding: 2rem;
  text-align: center;
  border-top: 1px solid #e0dcd4;
}
.subscribe-section h3 {
  font-family: "Libre Baskerville", Georgia, serif;
  color: #1a3a5c;
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}
.subscribe-section p {
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}
.subscribe-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}
.subscribe-row input[type="email"] {
  flex: 1;
  max-width: 300px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}
.subscribe-row button {
  padding: 0.5rem 1.25rem;
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}
.subscribe-row button:hover {
  background: #254d73;
}
.subscribe-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.subfield-picker {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #777;
}
.subfield-picker summary {
  cursor: pointer;
}
.subfield-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  justify-content: center;
  margin-top: 0.5rem;
  text-align: left;
}
.subfield-checkboxes label {
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
}
.subscribe-msg {
  font-size: 0.9rem;
  margin-top: 0.75rem;
}
.subscribe-msg.success { color: #2a7a2a; }
.subscribe-msg.error { color: #c33; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.8rem;
  color: #999;
  border-top: 1px solid #e0dcd4;
  margin-top: 2rem;
}
.site-footer a {
  color: #777;
  text-decoration: none;
}
.site-footer a:hover {
  color: #1a3a5c;
  text-decoration: underline;
}

/* ---------- SEO pages (journal, subfield, index) ---------- */
.breadcrumb {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.5rem;
}
.breadcrumb a { color: #1a3a5c; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.page-title {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.6rem;
  color: #1a3a5c;
  margin: 0.25rem 0 0.25rem;
}
.page-stats {
  font-size: 0.95rem;
  color: #8b6914;
  margin-bottom: 1rem;
}
.page-cta { margin-bottom: 1.5rem; }
.seo-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.seo-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #1a3a5c;
  color: #1a3a5c;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.seo-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.seo-table tr:nth-child(even) { background: #faf9f6; }
.seo-table a { color: #1a3a5c; text-decoration: none; }
.seo-table a:hover { text-decoration: underline; }
.server-pagination {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.server-pagination .page-btn {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  min-width: 2rem;
  text-align: center;
  border: 1px solid #d0cdc6;
  border-radius: 4px;
  color: #1a3a5c;
  text-decoration: none;
  font-size: 0.85rem;
  background: white;
}
.server-pagination .page-btn.active {
  background: #1a3a5c;
  color: white;
  border-color: #1a3a5c;
}
.server-pagination .page-btn:hover:not(.active):not(.ellipsis) {
  background: #f0ece4;
}
.server-pagination .page-btn.ellipsis {
  border: none;
  background: none;
}
.journal-index-item {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0ece4;
}
.journal-index-item a { color: #1a3a5c; text-decoration: none; }
.journal-index-item a:hover { text-decoration: underline; }
.journal-count { color: #888; font-size: 0.85rem; }
.letter-heading {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.2rem;
  color: #8b6914;
  margin: 1.5rem 0 0.5rem;
  border-bottom: 1px solid #e0dcd4;
  padding-bottom: 0.25rem;
}
.subfield-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.subfield-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1rem;
  border: 1px solid #e0dcd4;
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.subfield-card:hover {
  border-color: #8b6914;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.subfield-card-count {
  font-size: 0.85rem;
  color: #888;
}

/* ---------- Changelog ---------- */
.changelog {
  max-width: 720px;
}
.changelog-entry {
  margin-bottom: 2rem;
}
.changelog-entry h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.1rem;
  color: #1a3a5c;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid #e0dcd4;
  padding-bottom: 0.4rem;
}
.changelog-entry ul {
  margin: 0;
  padding-left: 1.25rem;
}
.changelog-entry li {
  margin-bottom: 0.3rem;
  color: #444;
  font-size: 0.95rem;
}

/* ---------- Sources section ---------- */
.sources-section {
  margin-bottom: 1.5rem;
}
.sources-section h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.1rem;
  color: #1a3a5c;
  margin: 0 0 0.75rem;
}
.sources-toggle {
  cursor: pointer;
  user-select: none;
}
.sources-toggle:hover {
  color: #8b6914;
}
.source-total {
  font-size: 0.85rem;
  font-weight: 400;
  color: #666;
}
.toggle-icon {
  font-size: 0.7rem;
  display: inline-block;
  transition: transform 0.2s;
  margin-left: 0.3rem;
}
.toggle-icon.open {
  transform: rotate(90deg);
}
.sources-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.source-card {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid #e0dcd4;
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: #1a3a5c;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.source-card:hover {
  border-color: #1a3a5c;
  box-shadow: 0 1px 4px rgba(26, 58, 92, 0.12);
}
.source-card .source-name {
  font-weight: 600;
}
.source-card .source-count {
  font-size: 0.75rem;
  color: #8b6914;
  font-weight: 600;
}

/* ---------- Quick actions ---------- */
.quick-actions {
  margin-bottom: 1rem;
}
.quick-action-btn {
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.quick-action-btn:hover {
  background: #254d73;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  .site-header h1 { font-size: 1.75rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar-group { min-width: 0; }
  .journal-dropdown { min-width: 100%; }
  .filter-grid { grid-template-columns: 1fr; }
  .results-bar { flex-direction: column; align-items: flex-start; }
}
