/* FNS Container & Archive Page */
div.fns-index-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 15px;
}
div.fns-index-container h1 {
  color: #5c2483;
  font-size: 2em;
  margin-bottom: 5px;
}
div.fns-index-container p.subtitle {
  color: #666666;
  font-size: 1.1em;
  margin-bottom: 30px;
}
ul.fns-entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
li.fns-entry-item {
  background: #ffffff;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
li.fns-entry-item .date {
  color: #888888;
  font-size: 0.9em;
  display: block;
  margin-bottom: 5px;
}
li.fns-entry-item h2 {
  margin: 0;
  font-size: 1.3em;
}
li.fns-entry-item h2 a {
  color: #245583;
  text-decoration: none;
  border-bottom: none;
}
li.fns-entry-item h2 a:hover {
  color: #5c2483;
}

/* FNS Article Pane */
a.fns-archive-link {
  display: inline-block;
  margin-bottom: 12px;
  color: #5c2483;
  font-size: 0.95em;
  text-decoration: none;
}
a.fns-archive-link:hover {
  text-decoration: underline;
}
#fns-article-pane {
  background: #ffffff;
  padding: 25px 30px;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}
.fns-title-row a.edit {
  margin-left: auto;
  font-size: 0.8em;
  color: #245583;
  text-decoration: none;
}
.fns-title-row a.edit:hover { text-decoration: underline; }
.fns-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
h1.fns-heading {
  color: #5c2483;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.8em;
  line-height: 1.3em;
}
a.fns-edit-link {
  flex: none;
  margin-top: 0.45em;
  font-size: 0.85em;
  color: #245583;
  text-decoration: none;
  white-space: nowrap;
}
a.fns-edit-link:hover {
  text-decoration: underline;
}
p.fns-subtitle {
  margin: 0 0 8px;
  color: #555555;
  font-size: 1.05em;
  line-height: 1.4;
}
div.fns-date {
  color: #888888;
  font-size: 0.9em;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eeeeee;
}
div.fns-body-rendered {
  font-size: 1.1em;
  line-height: 1.7em;
  color: #222222;
}
div.fns-body-rendered h2, div.fns-body-rendered h3 {
  color: #5c2483;
  margin-top: 1.4em;
  margin-bottom: 0.6em;
}
div.fns-body-rendered p {
  margin-bottom: 1.2em;
}
h1.fns-heading a.fns-internal-search,
div.fns-body-rendered a.fns-internal-search {
  color: #5c2483;
  font-weight: bold;
  background-color: #f3e9fb;
  padding: 2px 6px;
  border-radius: 4px;
  border-bottom: 1.5px solid #5c2483;
  transition: all 0.2s ease;
  cursor: pointer;
}
h1.fns-heading a.fns-internal-search:hover,
div.fns-body-rendered a.fns-internal-search:hover {
  background-color: #5c2483;
  color: #ffffff;
}
h1.fns-heading a.fns-external-link,
div.fns-body-rendered a.fns-external-link {
  color: #245583;
  border-bottom: 1px solid #245583;
}

/* Entry Navigation (Prev / Next) */
div.fns-entry-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eeeeee;
}
a.fns-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #f3e9fb;
  color: #5c2483;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: none;
  transition: all 0.2s ease;
  font-size: 0.95em;
}
a.fns-nav-btn:hover {
  background-color: #5c2483;
  color: #ffffff;
}
a.fns-nav-btn.next {
  margin-left: auto;
}

/* In-Page Results Pane (Underneath Article) */
#fns-results-pane {
  background: #ffffff;
  padding: 20px;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  margin-top: 20px;
  border-top: 4px solid #5c2483;
}
.fns-results-header {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eeeeee;
  position: relative;
}
button.fns-close-btn {
  float: right;
  background: #eeeeee;
  color: #555555;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9em;
  cursor: pointer;
}
button.fns-close-btn:hover {
  background: #dddddd;
  color: #222222;
}
h2.fns-query-title {
  margin: 0;
  font-size: 1.25em;
  color: #333333;
}
h2.fns-query-title span#fns-query-word {
  color: #5c2483;
  font-weight: bold;
}

/* Scrollable Recordings List underneath the text box */
#fns-recordings-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 8px;
  margin-top: 15px;
  margin-bottom: 0;
  list-style: none;
  padding-left: 0;
}
#fns-recordings-list li.recording {
  /* Skip layout/paint for off-screen cards; the intrinsic size keeps the
     scrollbar stable until a card is rendered. */
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}
#fns-recordings-list .fns-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: #666666;
  font-style: italic;
}

/* Custom scrollbar styling for search results list */
#fns-recordings-list::-webkit-scrollbar {
  width: 6px;
}
#fns-recordings-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}
#fns-recordings-list::-webkit-scrollbar-thumb {
  background: #5c2483;
  border-radius: 3px;
}
#fns-recordings-list::-webkit-scrollbar-thumb:hover {
  background: #441a62;
}

.fns-edit {
  max-width: 860px;
  margin: 20px auto 60px;
  padding: 0 20px;
}
.fns-kicker {
  margin: 0 0 8px;
}
.fns-kicker a {
  color: #5c2483;
  text-decoration: none;
}
.fns-edit-note {
  color: #666666;
  font-size: 0.95em;
  line-height: 1.45;
}
.fns-flash.ok {
  background: #eaf6ea;
  color: #2a6b2a;
  padding: 8px 12px;
  border-radius: 6px;
}
.fns-flash.err {
  background: #fdeaea;
  color: #8a1f1f;
  padding: 8px 12px;
  border-radius: 6px;
}
.fns-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin-top: 18px;
}
.fns-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9em;
  color: #444444;
}
.fns-edit-form label.full {
  grid-column: 1 / -1;
}
.fns-edit-form input,
.fns-edit-form textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #cccccc;
  border-radius: 6px;
}
.fns-edit-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
  line-height: 1.45;
}
.fns-edit-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: center;
}
.fns-edit-actions button {
  background: #5c2483;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font: inherit;
  cursor: pointer;
}
.fns-edit-actions a.button-secondary {
  color: #245583;
  text-decoration: none;
}
@media (max-width: 700px) {
  .fns-edit-form {
    grid-template-columns: 1fr;
  }
  .fns-title-row {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 800px) {
  div.mapList > div.map {
    z-index: 20;
  }
  div.mapList > div.list {
    position: relative;
    z-index: 1;
  }
  /* The results legend is moved into its own sticky box under the map on
     mobile (see placeFnsLegend in scripts.js), so the article text flows
     underneath while the legend stays put. */
  #fns-legend-box {
    position: sticky;
    /* The map is sticky at top:-1px with a 200px content height plus 1px top
       and bottom borders, so its bottom sits at 201px. Lock the legend there
       rather than at the top of the screen. */
    top: 201px;
    z-index: 20;
    background: #ffffff;
    border: 1px solid #e5dcef;
    border-radius: 8px;
    padding: 8px 10px;
    margin: 8px 0 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  }
  #fns-legend-box .fns-legend-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
  }
  #fns-legend-box .fns-legend-title {
    font-weight: 700;
    color: #5c2483;
    font-size: 0.95em;
  }
  #fns-legend-box .fns-legend-close {
    border: 0;
    background: transparent;
    color: #5c2483;
    font-size: 1.1em;
    cursor: pointer;
    padding: 2px 6px;
  }
  #fns-legend-box #fns-legend {
    position: static;
    z-index: auto;
    margin: 0;
    padding: 0;
  }
  #fns-legend:empty {
    display: none;
  }
}
