/* =============================
   NSF NGF DP — Clean Consolidated Styles
   ============================= */

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

:root {
  /* Layout width */
  --maxw: 1200px;
  --content-max: 1200px;

  /* Theme */
  --brand-red: #690303;
  --bg-soft: #f9f9f9;
  --border: #ccc;
  --text: #333;

  /* Typography */
  --fs-base: 13px;
  --fs-small: 12px;

  /* Buttons */
  --btn-font-size: 12px;
  --btn-height: 30px;
  --btn-radius: 6px;
  --btn-pad-x: 10px;
}

/* Optional: widen slightly on large screens */
@media (min-width: 1440px) {
  :root {
    --maxw: 1320px;
    --content-max: 1320px;
  }
}

html,
body {
  font-family: Arial, sans-serif;
  color: var(--text);
}

body {
  padding: 20px;
}

/* ---------- Utilities ---------- */
.maxw {
  max-width: var(--maxw);
  margin: 0 auto;
}

/* renamed from .maxw-1000 */
.subtitle {
  font-size: smaller;
}

.hr-line {
  display: block;
  margin-bottom: 6px;
  margin-right: 20px;
  max-width: 100%;
}

.muted {
  opacity: .75;
}

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

/* ---------- Headings / Labels ---------- */
#mainTitle {
  font-size: 1.5em;
  font-weight: bold;
  margin: .3em 0;
  line-height: 1.2;
  color: var(--text);
}

label {
  font-size: var(--fs-base);
  display: block;
  margin-bottom: 6px;
}

/* ---------- Layout wrapper ---------- */
.page-wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.page-wrap h3 {
  margin: 16px 0 8px;
  line-height: 1.25;
}

/* ---------- Branding ---------- */
.branding {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 10px;
  position: relative;
  z-index: 2000;
}

.logo-img {
  height: 60px;
}

#hrLine {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 6px 0 12px;
}

/* Quicklinks (kept above map) */
ul.quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  align-items: center;
  position: relative;
  z-index: 2000;
}

/* Keep list items as real boxes (more consistent across browsers) */
ul.quicklinks > li {
  display: inline-block;   /* works well with your existing flex container */
  position: relative;      /* ensures submenu positioning is anchored */
}

ul.quicklinks a {
  --pill-h: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--pill-h);
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  color: #5a0a0a;
  background: #f7f7f7;
  border: 1px solid #d7d7d7;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
  transition: transform .05s ease, box-shadow .2s ease, background .2s, color .2s, border-color .2s;
}

ul.quicklinks a:hover {
  background: var(--brand-red);
  color: #fff;
  border-color: #5c0a0a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

ul.quicklinks a:active {
  transform: translateY(1px);
}

ul.quicklinks a:focus-visible {
  outline: 2px solid #b21;
  outline-offset: 2px;
}

/* Submenu */
ul.quicklinks>li.has-submenu {
  display: inline-block;
  position: relative;
}

ul.quicklinks .submenu {
  display: none;
  position: absolute;
  top: calc(var(--pill-h) + 6px);
  left: 0;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid #d7d7d7;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  z-index: 2100;
  min-width: 200px;
  max-width: 340px;
  text-align: left;
}

/* hover only */
ul.quicklinks>li.has-submenu:hover .submenu {
  display: block;
}

/* Click-to-open support (your JS will toggle .open) */
ul.quicklinks > li.has-submenu.open .submenu {
  display: block;
}

/* Keyboard accessibility: tabbing into the menu opens dropdown */
ul.quicklinks > li.has-submenu:focus-within .submenu {
  display: block;
}

ul.quicklinks .submenu a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: var(--pill-h, 32px);
  padding: 0 12px;
  margin: 4px 0;
  white-space: nowrap;
  border-radius: 999px;
  width: 100%;
}

/* ---------- Leading menu icons (product logo or generic glyph) ---------- */
.quicklinks .submenu a .menu-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  object-fit: contain;
  vertical-align: middle;
}
/* Generic SVG icons use the link's own color, so they turn white on hover
   along with the text instead of needing a separate hover rule. */
svg.menu-icon {
  color: inherit;
}
.quicklinks .submenu a.repo-primary .menu-icon {
  width: 18px;
  height: 18px;
}

/* Text label next to the icon: truncates with an ellipsis instead of
   forcing the dropdown wider than the layout allows; full text is
   still available via the native title tooltip. */
.quicklinks .submenu a .menu-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Wide 2-column layout for the two large submenus
   (Product Repositories / Product Pages) ---------- */
ul.quicklinks .submenu.submenu-grid {
  min-width: 480px;
  max-width: 640px;
}
.submenu-grid .menu-section details > ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 10px;
}
/* Repository File Access / top pinned link still spans full width */
.submenu-grid > li[role="none"]:not(.menu-filter) {
  grid-column: 1 / -1;
}

/* Filter box pinned to the top of a grid submenu */
.menu-filter {
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
  z-index: 1;
}
.menu-filter-input {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border: 1px solid #d7d7d7;
  border-radius: 999px;
  outline: none;
  box-sizing: border-box;
}
.menu-filter-input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(107, 0, 0, 0.15);
}
.menu-empty {
  grid-column: 1 / -1;
  padding: 8px 12px;
  font-size: 12px;
  color: #718096;
  font-style: italic;
}
/* Hidden by the filter script when a label doesn't match */
.submenu [hidden] {
  display: none !important;
}
@media (max-width: 640px) {
  ul.quicklinks .submenu.submenu-grid {
    min-width: 0;
    max-width: min(92vw, 360px);
  }
  .submenu-grid .menu-section details > ul {
    grid-template-columns: 1fr;
  }
}

/* ---------- Containers ---------- */
.container {
  max-width: var(--maxw);
  background: #fff;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .1);
}

.container.wide {
  max-width: var(--maxw);
}

/* ---------- Forms / Inputs ---------- */
input[type="radio"] {
  position: relative;
  z-index: 10;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: smaller;
}

#varFilter,
#varSearchBox,
#gridRefSelect,
#gridDimSelect,
#regionSelect,
#pageSizeSelector {
  font-size: var(--fs-base);
  max-width: 200px;
}

#searchBox {
  width: 100%;
  padding: 4px;
  font-size: var(--fs-base);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ---------- Filters / Map Panel ---------- */
.filters {
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1em 1.5em;
  margin: 1.5em 0 2em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.filter-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 6px;
}

.filter-narrow {
  flex: 0 0 auto;
  min-width: 100px;
  max-width: 120px;
  padding-right: 8px;
  margin-right: 8px;
  box-shadow: 1px 0 0 #e0e0e0;
}

.filter-grid>.filter-narrow:last-child {
  box-shadow: none;
  margin-right: 0;
}

.filter-grid input,
.filter-grid select {
  width: 100%;
  padding: 3px 5px;
  font-size: var(--fs-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-sizing: border-box;
}

.filter-grid button {
  padding: 5px 8px;
  font-size: var(--fs-base);
  background: #e8e8e8;
  border: 1px solid #bbb;
  border-radius: 4px;
  cursor: pointer;
}

.filter-grid button:hover {
  background: #dcdcdc;
}

/* Layout containers */
.two-column {
  display: flex;
  gap: 20px;
  height: 280px;
}

.filter-left {
  flex: 0 0 40%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.filter-right {
  flex: 1;
}

.filter-map {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Map helpers */
#bboxMap {
  height: 260px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 10px;
}

#bboxMap .draggable-rect {
  cursor: grab;
}

#bboxMap.grabbing,
#bboxMap.grabbing * {
  cursor: grabbing !important;
}

.corner-handle {
  width: 12px;
  height: 12px;
  background: #1e40af;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 2px rgba(0, 0, 0, .5);
}

/* Keep the map behind general UI */
.leaflet-container {
  z-index: 1;
}

/* menu is 2000+, so it will be on top */

/* Depth legend (Leaflet) */
.leaflet-control.depth-legend {
  background: #fff;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 18px;
  color: #333;
  box-shadow: 0 0 4px rgba(0, 0, 0, .2);
}

.depth-legend .color-box {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  width: 100%;
  max-width: var(--maxw);
  table-layout: fixed;
  font-size: 14px;
}

th,
td {
  border: 1px solid var(--border);
  padding: 8px;
  vertical-align: top;
  overflow-wrap: break-word;
}

th {
  background: #f2f2f2;
}

tr:nth-child(even) {
  background: #f9f9f9;
}

.var-list {
  white-space: pre-wrap;
}

.variables-cell {
  grid-row: span 2;
}

.mini-map {
  width: 140px;
  height: 100px;
  border: 1px solid var(--border);
}

tr.selected {
  outline: 2px solid #4a90e2;
  background: #eef6ff;
}

/* Optional compact first column */
.table-cols-compact th:nth-child(1),
.table-cols-compact td:nth-child(1) {
  width: 20px;
}

/* Pagination */
#pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 8px 0 10px;
  font-size: smaller;
}

/* ---------- Collapsible Panels ---------- */
.collapsible-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1em;
}

.triangle {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #d33;
  transition: transform .25s ease;
}

.collapsible:not(.collapsed) .triangle,
.collapsible.open .triangle {
  transform: rotate(180deg);
}

.collapsible-content {
  margin: 10px 0;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  line-height: 1.6;
  width: 100%;
}

.collapsible.collapsed .collapsible-content {
  display: none;
}

/* Hide content when collapsed (specific section) */
#description.collapsible.collapsed .collapsible-content {
  display: none;
}

.toggle-indicator {
  margin-left: .35em;
}

/* Force description text to be left-aligned */
#description .collapsible-content {
  text-align: left;
}

/* ---------- Generic Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-height);
  padding: 0 var(--btn-pad-x);
  border: 1px solid var(--brand-red);
  background: #f9f2f2;
  color: var(--brand-red);
  border-radius: var(--btn-radius);
  font-size: var(--btn-font-size);
  font-weight: 400;
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  line-height: 1;
}

.btn:hover {
  background: var(--brand-red);
  color: #fff;
}

.btn[disabled],
.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  pointer-events: none;
}

.btn-primary {
  background: #f9f2f2;
  color: var(--brand-red);
}

.btn-primary:hover {
  background: #510202;
  color: #fff;
}

#renderBtn {
  height: var(--btn-height);
  padding: 0 var(--btn-pad-x);
  font-size: var(--btn-font-size);
}

/* ---------- Tabs ---------- */
.tab-container {
  display: block;
  margin: 0;
  padding: 0;
  max-width: var(--maxw);
}

.tab-buttons {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding-left: 0;
  margin: 0;
  gap: 0;
}

.tab-buttons button {
  background: #f1f1f1;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 10px 18px;
  margin: 0;
  cursor: pointer;
  font-weight: bold;
  color: #555;
  position: relative;
  top: 0;
  transition: all .2s ease-in-out;
}

.tab-buttons button:hover {
  background: #e6e6e6;
}

.tab-buttons button {
  background: #e9ecef;
  border: 1px solid #ccc;
  border-bottom: none;
  padding: 8px 14px;
  cursor: pointer;
}

.tab-buttons button.active {
  background: #ffffff;
  color: #000;
  border: 1px solid #ccc;
  border-bottom: 2px solid #007bff; /* strong accent */
  font-weight: 600;
  position: relative;
  z-index: 2;
}

.tab-content {
  display: none;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  animation: fadein .3s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadein {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Small components ---------- */
.form-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 16px 0 6px;
  padding: 6px 10px;
  background: #faf3f3;
  border: 1px solid #ead7d7;
  border-left: 4px solid var(--brand-red);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #2f1d1d;
}

.form-subtitle {
  margin: 4px 0 12px 12px;
  font-size: 12px;
  color: #555;
}

.form-row {
  margin: 6px 0;
}

.preview {
  margin-top: 14px;
}

.preview img {
  max-width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: block;
}

.preview figcaption {
  margin-top: 6px;
}

/* ---------- Product grid (outer) ---------- */
.product-grid {
  width: 100%;
  max-width: var(--maxw);
  margin: 4px 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  border: 1px solid #d1d5db;
}

.product-grid thead th {
  border: 1px solid #d1d5db;
}

.product-grid tbody td {
  border: none;
}

.product-grid thead th {
  background: #e5e7eb;
  text-align: left;
  font-weight: 700;
  padding: 4px 6px;
  line-height: 1.1;
  white-space: nowrap;
}

.product-grid tbody td {
  padding: 2px 6px;
  line-height: 1.25;
  vertical-align: middle;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.product-grid th:first-child,
.product-grid td:first-child {
  width: 26px;
  text-align: center;
}

/* Local layout container for the panels on this page only */
.product-grid-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.product-grid-wrapper>.panel {
  flex: 1 1 calc(50% - 20px);
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .product-grid-wrapper>.panel {
    flex: 1 1 100%;
  }
}

/* Make the 2 columns equal width and stable */
table.product-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 12px;
}

table.product-grid td {
  vertical-align: top;
}

/* keep empty last cell from collapsing visually */
td.blank-cell {
  /* spacer */
}

/* ---------- Panel header + inner table ---------- */
.panel {
  margin: 0;
}

.panel-header {
  background: #f3f4f6;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 4px 6px;
  border-radius: 6px 6px 0 0;
}

.panel-inner {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border-spacing: 0;
}

.panel-inner col.col-thumb {
  width: 25%;
}

.panel-inner col.col-body {
  width: 75%;
}

.panel-inner td {
  border: none;
  vertical-align: top;
  padding: .35rem .6rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel-inner td.thumb {
  text-align: left;
}

/* left-align override */
.panel-inner .thumb img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

/* Make inner content consistently left-aligned */
.panel-inner td {
  text-align: left;
}

/* Or more specifically: */
.panel-inner td:nth-child(2),
.panel-inner td:nth-child(2) p,
.panel-inner td:nth-child(2) small {
  text-align: left;
}

/* ---------- Footer lists ---------- */
.site-footer {
  max-width: var(--maxw);
  margin-top: 18px;
}

.site-footer ul {
  list-style: circle;
  margin-left: 20px;
  padding-left: 0;
}

.site-footer ul li {
  margin-bottom: 10px;
}

.site-footer ul li:last-child {
  margin-bottom: 0;
}

/* ===== Compact event table overrides ===== */
#eventTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  margin: 4px 0;
}

#eventTable thead th {
  background: #e5e7eb;
  text-align: left;
  font-weight: 700;
  padding: 4px 6px;
  line-height: 1.1;
  border-bottom: 1px solid #d1d5db;
  white-space: nowrap;
}

#eventTable tbody td {
  padding: 2px 6px;
  line-height: 1.25;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#eventTable tbody tr:last-child td {
  border-bottom: 0;
}

#eventTable th:first-child,
#eventTable td:first-child {
  width: 26px;
  text-align: center;
}

#eventTable th,
#eventTable td {
  margin: 0;
}

#eventTable tbody tr.clickable {
  cursor: pointer;
}

#eventTable tbody tr.clickable input,
#eventTable tbody tr.clickable button,
#eventTable tbody tr.clickable select,
#eventTable tbody tr.clickable a {
  cursor: auto;
}

#eventTable tbody tr.clickable:hover {
  background: #f7fafc;
}

/* Center FM header text both horizontally + vertically */
#eventTable thead th[data-fm-column="1"] {
  text-align: center !important;
  vertical-align: middle !important;
  padding: 0 !important;
  /* no extra left/right padding */
  line-height: 1.1;
  /* keeps it visually centered */
}

/* Remove the outer border/padding around the Filters block on this page */
#filterSection .collapsible-content.plain {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* Tighten the header-to-content gap */
#filterSection .collapsible-header {
  margin-bottom: 6px;
}

/* Albums area */
#albumsContainer,
#albumsContainer .tab-container,
#albumsContainer .tab-content {
  max-width: 100%;
  min-width: 0;
}

#albumsContainer .tab-content {
  overflow: hidden;
}

#albumsContainer .screen-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(260px, 70vh, 900px);
  object-fit: contain;
  margin: 0 auto;
}

#albumsContainer video.screen-image {
  width: 100%;
  height: auto;
  object-fit: contain;
}

#albumsContainer .thumbnail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
}

#albumsContainer .thumbnail {
  width: 120px;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#albumsContainer .media-title,
#albumsContainer .image-description {
  overflow-wrap: anywhere;
}

/* Shared centered wrappers */
#albumsContainer,
#downloadButtonContainer {
  max-width: var(--content-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-inline: 12px;
  box-sizing: border-box;
  display: block;
}

#downloadButtonContainer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

#downloadButtonContainer>* {
  margin-left: 0 !important;
  margin-right: 0 !important;
  float: none !important;
}

/* Misc */
#usgsCell,
#usgsCell .usgs-info {
  text-align: left;
}

.muted[aria-disabled="true"] {
  color: #999;
  text-decoration: none;
  cursor: default;
  pointer-events: none;
}

.thumb-video {
  width: 240px;
  height: 135px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.thumbnail {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  cursor: pointer;
}

/* Smaller select + options */
#regionSelect.filter-select-small,
#regionSelect.filter-select-small option,
#regionSelect.filter-select-small optgroup,
.filter-select-small,
.filter-select-small option,
.filter-select-small optgroup {
  font-size: 11px;
  line-height: 1.2;
}

#regionSelect.filter-select-small optgroup {
  font-weight: 600;
  color: #444;
}

/* Crumbs */
.crumbs {
  font-size: 13px;
  color: #666;
  margin: 10px 0 0;
}

.crumbs a {
  color: #2b5ea1;
  text-decoration: none;
}

/* Make the filter section grow to fit its content in all browsers */
#filterSection {
  overflow: visible !important;
  max-height: none !important;
  height: auto !important;
}

/* Apply to all collapsible-content inside filterSection, not just .plain */
#filterSection .collapsible-content {
  max-height: none !important;
  overflow: visible !important;
  height: auto !important;
}

.map-legend {
  margin-top: 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 8px;
  max-height: 160px;
  overflow-y: auto;

  /* Make sure it floats above table/pagination */
  position: relative;
  z-index: 2000;
}

/* ---------- Submenu link pills (all dropdowns) ---------- */
ul.quicklinks .submenu a {
  display: flex;
  align-items: center;
  justify-content: flex-start;

  /* let height be driven by padding instead of a fixed height */
  height: auto;
  padding: 6px 14px;
  margin: 4px 0;

  white-space: nowrap;
  border-radius: 999px;
  width: 100%;
}

/* ---------- Submenu link pills (all dropdowns) ---------- */
ul.quicklinks .submenu a {
  display: flex;
  align-items: center;
  justify-content: flex-start;

  /* let height be driven by padding instead of a fixed height */
  height: auto;
  padding: 6px 14px;
  margin: 4px 0;

  white-space: nowrap;
  border-radius: 999px;
  width: 100%;
}

/* ---------- Old-style non-collapsible section heading (if still used) ---------- */
.menu-section-title {
  font-size: 0.90em;
  font-weight: 700;
  padding: 8px 14px;
  margin: 16px 0 4px 0;

  background: #f2f2f2;
  border-left: 6px solid #6b0000;
  /* EarthScope maroon */
  border-top: 2px solid #e0e0e0;
  border-bottom: 2px solid #e0e0e0;

  color: #3a3a3a;
  text-transform: uppercase;
  letter-spacing: 0.8px;

  cursor: default;
  pointer-events: none;
}

/* ---------- Collapsible submenu groups (Product Catalog / Repository) ---------- */

/* Ensure no bullets in any submenu lists */
ul.quicklinks .submenu,
ul.quicklinks .submenu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Group container */
.quicklinks .submenu .menu-section {
  margin: 0;
}

/* Extra separation between groups */
.quicklinks .submenu .menu-section+.menu-section {
  margin-top: 14px;
}

/* Group header (summary) — lighter than repo-primary so it doesn't dominate */
.quicklinks .submenu .menu-section summary {
  display: flex;
  align-items: center;

  font-weight: 700;
  font-size: 12.5px;                 /* same size as repo-primary items */
  padding: 8px 14px;
  margin: 6px 0 4px;

  color: #5a0a0a;                    /* maroon text */
  background: #f4e9e9;               /* soft maroon tint */
  border: 1px solid #e2cccc;
  border-left: 6px solid var(--brand-red);   /* maroon accent band */
  border-radius: 4px;

  cursor: pointer;
}

/* Leading star to match repo-primary */
.quicklinks .submenu .menu-section summary::before {
  content: "★";
  margin-right: 8px;
  font-size: 0.9em;
  line-height: 1;
}

/* Deepen the tint slightly on hover */
.quicklinks .submenu .menu-section summary:hover {
  background: #ecdada;
  border-left-color: #4d0202;
}

/* First group can sit a bit closer to the top edge of the dropdown */
.quicklinks .submenu .menu-section:first-child summary {
  margin-top: 4px;
}

/* Hide default marker */
.quicklinks .submenu .menu-section summary::-webkit-details-marker {
  display: none;
}

/* Custom arrow on the right */
.quicklinks .submenu .menu-section summary::after {
  content: "▸";
  margin-left: auto;
  font-size: 0.85em;
  transform: translateY(1px);
}

.quicklinks .submenu .menu-section details[open] summary::after {
  content: "▾";
}

/* Inner list spacing */
.quicklinks .submenu .menu-section details>ul {
  margin: 4px 0 6px;
  padding-left: 4px;
  /* tiny indent so pills don't touch the band */
}

/* Submenu links inside groups use the same pill style, just inherit from above */
.quicklinks .submenu .menu-section details>ul>li a {
  /* No extra styles needed, but you can tweak padding slightly if desired: */
  padding-left: 16px;
  padding-right: 16px;
}

.github-pill {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #24292f;
  border-radius: 999px;
  background: #f1f1f1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.product-section-row .product-section-heading {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  background: #f4f6f8;
  border-top: 2px solid #ccc;
}

.product-section-row:first-child .product-section-heading {
  border-top: none;
}

.panel {
  border-radius: 4px;
  border: 1px solid #ddd;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  background: #fff;
}

.panel:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.panel-header-link {
  text-decoration: none;
  color: inherit;
}

.panel-header-link:hover,
.panel-header-link:focus {
  text-decoration: underline;
}

@media (max-width: 800px) {

  .product-grid,
  .product-grid tbody,
  .product-grid tr,
  .product-grid td {
    display: block;
    width: 100%;
  }

  .product-grid td {
    margin-bottom: 1rem;
  }

  .product-section-heading {
    margin-top: 1.5rem;
  }
}

.product-section-row .product-section-heading {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  background: #f4f6f8;
  border-top: 2px solid #ccc;
}

.product-section-heading {
  border-left: 4px solid #690303;
}

.product-section-heading {
  border-left: 4px solid #690303;
}

.product-section-row .product-section-heading {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 1.15rem;
  background: #fafafa;
  border-left: 6px solid #690303;
  /* EarthScope brand accent */
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

.fm-badge {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, .25);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

/* Make width rules actually apply */
#eventTable {
  table-layout: fixed;
  width: 100%;
}

/* checkbox */
#eventTable th[data-sort-key=""],
#eventTable td.col-check {
  width: 34px;
  max-width: 34px;
  text-align: center;
  white-space: nowrap;
}

/* Time can be moderately narrow or flexible (your call) */
#eventTable th[data-sort-key="Time"],
#eventTable td.col-time {
  width: 210px;
  /* adjust if needed */
  max-width: 210px;
  white-space: nowrap;
}

/* Narrow numeric columns */
#eventTable th[data-sort-key="Depth"],
#eventTable td.col-depth {
  width: 55px;
  max-width: 55px;
  text-align: right;
  white-space: nowrap;
}

#eventTable th[data-sort-key="Magnitude"],
#eventTable td.col-mag {
  width: 85px;
  max-width: 85px;
  text-align: right;
  white-space: nowrap;
}

#eventTable th[data-sort-key="Latitude"],
#eventTable td.col-lat,
#eventTable th[data-sort-key="Longitude"],
#eventTable td.col-lon {
  width: 70px;
  max-width: 70px;
  text-align: right;
  white-space: nowrap;
}

/* Region gets the remaining space */
#eventTable th[data-sort-key="Region"],
#eventTable td.col-region {
  width: auto;
}

/* Region display choice: pick one */

/* A) single line + ellipsis */
#eventTable td.col-region {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Optional: nicer numeric alignment */
#eventTable td {
  font-variant-numeric: tabular-nums;
}

/* FM column */
#eventTable th[data-fm-column="1"],
#eventTable td.col-fm {
  width: 54px;
  max-width: 54px;
  text-align: center;
  white-space: nowrap;
}

/* FM column cell: no padding, no border */
#eventTable td.col-fm {
  padding: 0 !important;
  border: none;
  text-align: center;
  vertical-align: middle;
}

/* FM header cell: keep it tight too */
#eventTable th[data-fm-column="1"] {
  padding: 0;
  text-align: center;
}

/* The thumbnail itself */
#eventTable td.col-fm img.fm-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

#eventTable th[data-fm-column="1"],
#eventTable td.col-fm {
  width: 34px;
  /* adjust to taste */
  max-width: 34px;
  padding: 1;
}

/* --- Fix oversized images in single-column (colspan=2) rows --- */

/* Always constrain product logos */
.panel-inner td.thumb img {
  max-width: 140px;
  /* pick your desired visual size */
  width: 100%;
  height: auto;
}

/* Center the logo vertically + horizontally */
.panel-inner td.thumb {
  text-align: center;
  vertical-align: middle;
}

/* When a product spans two columns, rebalance inner layout */
td.span-2 .panel-inner col.col-thumb {
  width: 18%;
}

td.span-2 .panel-inner col.col-body {
  width: 82%;
}

/* =========================================================
   Force identical logo size in ALL product panels
   ========================================================= */

/* Fixed logo box */
.panel-inner td.thumb img {
  width: 120px;
  /* ← this is the key */
  max-width: 120px;
  height: auto;
  display: block;
  margin: 0 auto;
  /* center horizontally */
}

/* Keep thumb cell tidy */
.panel-inner td.thumb {
  text-align: center;
  vertical-align: middle;
  padding: 6px;
}
.usgs-info.two-col {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
}

.usgs-info.two-col .label {
  font-weight: 600;
  white-space: nowrap;
}
.two-col {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
}

.two-col .label {
  font-weight: 600;
  white-space: nowrap;
}

#eventTable th.col-time,  #eventTable td.col-time  { width: 210px; max-width: 210px; white-space: nowrap; }
#eventTable th.col-depth, #eventTable td.col-depth { width: 55px;  max-width: 55px;  white-space: nowrap; text-align: right; }
#eventTable th.col-mag,   #eventTable td.col-mag   { width: 85px;  max-width: 85px;  white-space: nowrap; text-align: right; }
#eventTable th.col-lat,   #eventTable td.col-lat   { width: 70px;  max-width: 70px;  white-space: nowrap; text-align: right; }
#eventTable th.col-lon,   #eventTable td.col-lon   { width: 70px;  max-width: 70px;  white-space: nowrap; text-align: right; }
#eventTable th.col-all-prods,
#eventTable td.col-all-prods {
  width: 260px;
  max-width: 360px;
  white-space: normal;  
  text-align: left;
}#eventTable th.col-es-arch  { width: 90px;  max-width: 120px;  white-space: nowrap; text-align: right; }
#eventTable th.col-shake-movie  { width: 90px;  max-width: 120px;  white-space: nowrap; text-align: right; }
#eventTable td.col-shake-movie,
#eventTable td.col-all-prods,
#eventTable td.col-es-arch {
  text-align: left;
  vertical-align: middle;
}
#eventTable td.col-shake-movie img,
#eventTable th.col-all-prods img,
#eventTable td.col-es-arch img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.fm-tooltip-caption {
  font-size: 10px;
  color: #444;
  max-width: 140px;
  text-align: center;
  word-break: break-word;
}

.prod-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: left;
}

#eventsTitle { display: flex; align-items: center; gap: 8px; }

  /* hidden by default */
  #tableLoadingSpinner { display: none; }

  /* show + animate when active */
  #tableLoadingSpinner.is-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0,0,0,0.25);
    border-top-color: rgba(0,0,0,0.75);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin { to { transform: rotate(360deg); } }

  .quicklinks > li.featured > a {
    font-weight: 700;
  }
  .quicklinks > li.featured > a::before {
    content: "★ ";
  }
  .menu-divider {
    border-top: 1px solid rgba(0,0,0,0.15);
    margin: 0.35rem 0;
  }

  .media-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    padding: 0.75rem;
    border: 1px dashed #aaa;
    background: #f7f7f7;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
  }
/* =========================================================
   Popular Repositories — highlight the two major groups
   (EMC + Event-Based Products)
   Add class="repo-primary" to those two <a> links in the
   "Popular Repositories" submenu.
   ========================================================= */
.quicklinks .submenu a.repo-primary {
  font-weight: 700;
  font-size: 12.5px;                        /* slightly larger than the 11.5px pills */
  color: #5a0a0a;                           /* maroon text */
  background: #f4e9e9;                       /* soft maroon tint */
  border: 1px solid #e2cccc;
  border-left: 6px solid var(--brand-red);  /* maroon accent band */
  border-radius: 4px;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Leading marker retired now that repo-primary items carry a real
   product icon (.menu-icon) instead of a plain star. */
.quicklinks .submenu a.repo-primary::before {
  content: none;
}

/* Deepen the tint slightly on hover */
.quicklinks .submenu a.repo-primary:hover {
  background: #ecdada;
  color: #5a0a0a;
  border-left-color: #4d0202;
}

/* ---------- "Show more" inside description ---------- */
#description .desc-rest {
  display: none;
}
#description.desc-expanded .desc-rest {
  display: block;
}
.desc-toggle {
  display: inline-block;
  margin-top: 6px;
  color: #d33;
  cursor: pointer;
  font-size: smaller;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
}
.desc-toggle:hover {
  text-decoration: underline;
}

/* ---------- Description section ---------- */
#description .collapsible-content {
  text-align: left;
}

#description p {
  margin: 0 0 0.6em;   /* tune this one number to taste */
}

#description p:last-child {
  margin-bottom: 0;
}

/* keep the paragraph before the toggle from double-spacing */
#description .desc-rest > p:last-child {
  margin-bottom: 0;
}

#description .desc-rest {
  display: none;
  margin-top: 0.6em;
}

#description.desc-expanded .desc-rest {
  display: block;
}

.desc-toggle {
  display: inline-block;
  margin-top: 0.6em;
  color: #d33;
  cursor: pointer;
  font-size: smaller;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
}

.desc-toggle:hover {
  text-decoration: underline;
}
#description .desc-title {
  margin: 0 0 0.5em;
  font-size: 1em;
}