/*
 * Single-page publication controls.
 * Author: Jian Cheng (jian.cheng.1983@gmail.com)
 * Date: 2026-07-18
 */

.publication-controls {
  --publication-blue: #2474a6;
  --publication-blue-dark: #185576;
  --publication-border: #ccd8df;
  box-sizing: border-box;
  max-width: 60rem;
  margin: 1.5rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--publication-border);
  border-radius: 6px;
  background: linear-gradient(135deg, #f8fbfc 0%, #eef5f8 100%);
}

.publication-controls-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 0.9rem;
}

.publication-controls input[type="search"],
.publication-controls select {
  box-sizing: border-box;
  width: 100%;
  height: 2.55rem;
  margin: 0;
  padding: 0 0.75rem;
  border: 1px solid #9fb3bf;
  border-radius: 4px;
  background: #fff;
  color: #26343c;
}

.publication-result-status {
  min-width: 7.5rem;
  padding: 0 0.2rem;
  color: #4a5d68;
  font-weight: bold;
  text-align: right;
  white-space: nowrap;
}

.publication-summary-venue {
  white-space: nowrap;
}

.publication-summary-venue:hover,
.publication-summary-venue:focus {
  text-decoration: underline;
}

.publication-search-highlight {
  background: #ffe89a;
  color: inherit;
  font: inherit;
}

.publication-control-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.65rem;
}

.publication-control-row[hidden] {
  display: none;
}

.publication-control-title {
  margin: 0;
  color: #344b58;
  font-weight: bold;
}

.publication-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.publication-choice-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.publication-choice-group label {
  margin: 0;
  padding: 0.42rem 0.75rem;
  border: 1px solid #9fb3bf;
  border-radius: 999px;
  background: #fff;
  color: #38515e;
  cursor: pointer;
  line-height: 1.2;
}

.publication-choice-group input:checked + label {
  border-color: var(--publication-blue);
  background: var(--publication-blue);
  color: #fff;
}

.publication-choice-group input:focus + label {
  outline: 2px solid #f1c40f;
  outline-offset: 2px;
}

.publication-venue-wrap {
  min-width: 0;
}

.publication-reset {
  min-height: 2.45rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--publication-blue-dark);
  border-radius: 4px;
  background: transparent;
  color: var(--publication-blue-dark);
  font-weight: bold;
  cursor: pointer;
}

.publication-reset:hover,
.publication-reset:focus {
  background: var(--publication-blue-dark);
  color: #fff;
}

.publication-generated-content.is-enhanced > h2,
.publication-generated-content.is-enhanced > ol,
.publication-generated-content.is-enhanced > br {
  display: none;
}

.publication-view {
  margin-top: 1.25rem;
}

.publication-group h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #d9e2e7;
}

.publication-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.55rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #e8f1f5;
  color: #315766;
  font-family: proxima-nova, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.75rem;
}

.publication-group .publication-item {
  margin-bottom: 1.15rem;
}

.publication-empty {
  padding: 2rem 1rem;
  border: 1px dashed #a9bac3;
  border-radius: 5px;
  color: #536a76;
  text-align: center;
}

.publication-modal-open {
  overflow: hidden;
}

.publication-modal[hidden] {
  display: none;
}

.publication-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(16, 32, 44, 0.56);
}

.publication-modal-panel {
  box-sizing: border-box;
  width: min(48rem, 100%);
  max-height: min(42rem, calc(100vh - 3rem));
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.publication-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 16.43px;
  padding: 15px;
  border-bottom: 1px solid #e5e5e5;
  background: #fff;
}

.publication-modal-header h2 {
  margin: 0;
  color: #333;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.42857143;
}

.publication-modal-close {
  width: auto;
  height: auto;
  margin: -2px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  cursor: pointer;
  filter: alpha(opacity=20);
  float: right;
  font-family: Arial, sans-serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.35;
  text-shadow: 0 1px 0 #fff;
}

.publication-modal-close:hover,
.publication-modal-close:focus {
  color: #000;
  opacity: 0.65;
  outline: 0;
  text-decoration: none;
}

.publication-modal-body {
  max-height: calc(min(42rem, 100vh - 3rem) - 4rem);
  overflow: auto;
  padding: 15px;
  color: #333;
}

.publication-modal-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

@media screen and (max-width: 700px) {
  .publication-controls-search,
  .publication-control-row {
    grid-template-columns: 1fr;
  }

  .publication-result-status {
    text-align: left;
  }

  .publication-choice-group {
    display: grid;
    grid-template-columns: 1fr;
  }

  .publication-choice-group label {
    text-align: center;
  }

  .publication-reset {
    width: 100%;
  }
}
