@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=STIX+Two+Text:wght@400;500;600;700&display=swap");

:root {
  --rnaq-navbar-h: 56px;
  --rnaq-table-cell-max-lines: 5;
  --rnaq-table-cell-line-height: 1.4;
}

body, button, input, select, textarea {
  font-family: "Hanken Grotesk", "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.rnaq-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.24);
  background: #ffffff;
  z-index: 1000;
}
.rnaq-navbar-inner {
  max-width: 100%;
  margin: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--rnaq-navbar-h);
}
@media (min-width: 600px) {
  .rnaq-navbar-inner {
    padding: 10px 38px;
  }
}
.rnaq-navbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.rnaq-navbar-logo {
  height: 24px;
  width: auto;
}
.rnaq-navbar-title {
  font-family: "STIX Two Text", serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
  line-height: 30px;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}
.rnaq-navbar-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95rem;
}
.rnaq-navbar-links a {
  color: #111111;
  text-decoration: none;
}
.rnaq-navbar-links a:hover {
  text-decoration: underline;
  color: #6B5CE8;
}
.not-footer {
  padding-top: var(--rnaq-navbar-h);
}
@media (max-width: 900px) {
  .rnaq-navbar-inner {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 16px;
  }
  .rnaq-navbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }
  .rnaq-navbar-title {
    max-width: 100%;
    white-space: normal;
  }
  .rnaq-navbar-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* RP-621: Datasette light mode overrides */
body,
.not-footer,
section.content {
  background: #ffffff;
  color: #111111;
}

a:link,
a:visited,
section.content a:link,
section.content a:visited,
button.button-as-link {
  color: #111111 !important;
}

a:hover,
a:focus,
a:active,
section.content a:hover,
section.content a:focus,
section.content a:active,
button.button-as-link:hover,
button.button-as-link:focus {
  color: #6B5CE8 !important;
}

header,
footer {
  background-color: #ffffff !important;
  color: #111111 !important;
  padding: 0.7rem 38px 0.6rem 38px;
}

header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

footer {
  border-top: 1px solid rgba(0, 0, 0, 0.18);
  margin-top: 1rem;
}

header a:link,
header a:visited,
header a:hover,
header a:focus,
header a:active,
footer a:link,
footer a:visited,
footer a:hover,
footer a:focus,
footer a:active,
header button.button-as-link,
footer button.button-as-link {
  color: #111111 !important;
}

header a:hover,
header a:focus,
header a:active,
footer a:hover,
footer a:focus,
footer a:active,
header button.button-as-link:hover,
header button.button-as-link:focus,
footer button.button-as-link:hover,
footer button.button-as-link:focus {
  color: #6B5CE8 !important;
}

header .crumbs a {
  text-decoration: none;
  font-weight: 500;
}

header .crumbs a:hover,
header .crumbs a:focus {
  text-decoration: underline;
}

details .nav-menu-inner {
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.nav-menu-inner a {
  color: #111111 !important;
}

.nav-menu-inner a:hover,
.nav-menu-inner a:focus {
  color: #6B5CE8 !important;
}

@media (max-width: 900px) {
  header,
  footer {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* RP-621: detailed route overrides (tables/forms/actions) */
.page-header {
  border-color: #6B5CE8 !important;
}

form input[type=submit],
form button[type=submit] {
  color: #ffffff !important;
  background-color: #6B5CE8 !important;
  border-color: #6B5CE8 !important;
}

form button[type=button] {
  color: #111111 !important;
  background-color: #ffffff !important;
  border-color: #6B5CE8 !important;
}

form input[type=text],
form input[type=search],
form textarea,
form select,
.select-wrapper,
.filters input.filter-value {
  color: #111111 !important;
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
}

form input[type=text]:focus,
form input[type=search]:focus,
form textarea:focus,
form select:focus,
.select-wrapper:focus-within,
.filters input.filter-value:focus {
  border-color: #6B5CE8 !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(107, 92, 232, 0.16);
}

.export-links a,
.table-wrapper a,
.facet-info a,
.actions-menu-links a,
.dropdown-menu a,
.sql-links a {
  color: #111111 !important;
}

.export-links a:hover,
.table-wrapper a:hover,
.facet-info a:hover,
.actions-menu-links a:hover,
.dropdown-menu a:hover,
.sql-links a:hover {
  color: #6B5CE8 !important;
}

/* RP-627: keep long metadata table cells readable without exploding row height */
.table-wrapper {
  overflow-x: auto;
  scrollbar-gutter: stable both-edges;
  contain: paint;
  will-change: scroll-position;
}

.rnaq-floating-table-scrollbar {
  position: fixed;
  left: 0;
  bottom: 10px;
  width: 0;
  height: 18px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  z-index: 1100;
  transition: opacity 160ms ease, transform 160ms ease;
  contain: layout paint;
}

.rnaq-floating-table-scrollbar.is-visible {
  pointer-events: auto;
}

.rnaq-floating-table-scrollbar-visual {
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  pointer-events: auto;
}

.rnaq-floating-table-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 36px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  cursor: grab;
  will-change: transform;
  backface-visibility: hidden;
}

.rnaq-floating-table-scrollbar-thumb:active {
  cursor: grabbing;
}

.rnaq-floating-table-scrollbar.is-dragging {
  transition: none;
}

.rnaq-floating-table-scrollbar.is-dragging .rnaq-floating-table-scrollbar-thumb {
  box-shadow: none;
}

.rows-and-columns tbody td {
  position: relative;
}

.rows-and-columns tbody td > .rnaq-cell-clamp {
  position: relative;
  display: block;
  max-width: 100%;
  line-height: var(--rnaq-table-cell-line-height);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media only screen and (min-width: 577px) {
  .table-wrapper > .rows-and-columns {
    width: max-content;
    min-width: 100%;
  }

  .rows-and-columns th.rnaq-column--wordy,
  .rows-and-columns td.rnaq-column--wordy {
    width: var(--rnaq-column-preferred-width);
    max-width: var(--rnaq-column-preferred-width);
  }
}

.rows-and-columns tbody td.rnaq-column--wordy > .rnaq-cell-clamp {
  width: var(--rnaq-column-preferred-width);
  max-width: var(--rnaq-column-preferred-width);
  max-height: calc(1em * var(--rnaq-table-cell-line-height) * var(--rnaq-table-cell-max-lines));
  overflow-x: hidden;
  overflow-y: scroll;
  padding-right: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  scrollbar-gutter: stable;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rows-and-columns tbody td.rnaq-column--wordy > .rnaq-cell-clamp::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-clamp {
  border: 1px solid rgba(107, 92, 232, 0.2);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 62%, rgba(107, 92, 232, 0.1) 100%);
}

.rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-scrollbar {
  position: absolute;
  top: 0.28rem;
  right: 0.25rem;
  bottom: 0.28rem;
  width: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 2;
  touch-action: none;
}

.rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-scrollbar > .rnaq-cell-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 1px;
  right: 1px;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(110, 110, 110, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85);
  cursor: grab;
}

.rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-scrollbar > .rnaq-cell-scrollbar-thumb:active {
  cursor: grabbing;
}

.rows-and-columns tbody td.rnaq-cell--overflowing::after {
  content: "";
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  bottom: 0.2rem;
  height: 14px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(107, 92, 232, 0.14));
  pointer-events: none;
}

.rnaq-horizontal-scrolling .rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-clamp {
  background: rgba(255, 255, 255, 0.98);
}

.rnaq-horizontal-scrolling .rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-scrollbar {
  box-shadow: none;
}

.rnaq-horizontal-scrolling .rows-and-columns tbody td.rnaq-cell--overflowing > .rnaq-cell-scrollbar > .rnaq-cell-scrollbar-thumb {
  box-shadow: none;
}

.rnaq-horizontal-scrolling .rows-and-columns tbody td.rnaq-cell--overflowing::after {
  opacity: 0;
}

/* RP-621: sticky footer when page content is short */
html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.not-footer {
  flex: 1 0 auto;
  width: 100%;
}

footer.ft {
  margin-top: auto !important;
  width: 100%;
}
