:root {
  --fr--color-sapphire-blue: #014371;
  --fr--color-sea-blue: #00639a;
  --fr--color-independence: #4e5a71;
  --fr--color-gainsborough: #d2dce3;
  --fr--color-platinum: #e4e8eb;
  --fr--color-sky-white: #fbfeff;
  --fr--color-yankees-blue: #161d39;

  --top-header-margin: 3rem;

  --bg-page: #f7f6f2;
  --text-white: #fbfeff;
  --green: #776c4d;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --radius-sm: 4px;
}

html,
body {
  font-family: Lato, sans-serif;
  background-image: url("../images/header.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: top center;
}

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

a {
  color: var(--fr--color-sapphire-blue);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  color: color-mix(in srgb, var(--fr--color-sapphire-blue) 90%, white);
}

hr.header-separator {
  margin: 0;
  border: none;
  border-top: 1px solid rgb(255, 255, 255);
}

.header {
  display: flex;
  align-items: center;
  align-content: center;
  color: rgba(255, 255, 255, 0.633);
  padding: 0.5em 1em;
  height: var(--top-header-margin);
}

.header > * {
  flex: 0 0 auto;
}

.header .header__link {
  align-self: baseline;
}

.header a,
.header button.button,
.header a:link,
.header a:visited,
.header a:hover,
.header a:active,
.header .header__link > a {
  display: inline-block;
  color: var(--text-white);
  margin-bottom: 0;
  text-decoration: none;
  transition:
    background-color 0.25s ease-out,
    color 0.25s ease-out;
}

.header__navigation {
  flex-shrink: 1;
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
  padding: 0 0.5ch;
  gap: 0.5ch;
  scrollbar-width: none;
}

.header__navigation > ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5ch;
  margin: 0;
  padding: 0;
}

.header__navigation > ul > li {
  display: inline-flex;
}

.header__navigation::-webkit-scrollbar {
  display: none;
}

.header__navigation a,
.header__navigation button.button {
  margin: 0.1rem 0.25rem;
  border-bottom: 1px solid transparent;
}

.header__navigation a:hover,
.header__navigation button.button:hover {
  border-bottom-color: currentColor;
}

.header .logo:hover {
  border-bottom-color: transparent;
  color: var(--text-white);
  cursor: pointer;
}

.header__search {
  flex: 1;
}

.header__search input,
.header__search button {
  margin: 0;
}

.logo {
  font-family: Lato, sans-serif;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.logo-badge {
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 2px 6px;
}

main {
  flex: 1;
  background-color: var(--bg-page);
  box-sizing: border-box;
  overflow: auto;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem);
}

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

.organism-page {
  color: #1a1a18;
}

.organism-detail {
  max-width: none;
}

.organism-back-row {
  margin-bottom: 1rem;
}

.organism-back-row a,
.organism-empty a {
  color: var(--fr--color-sapphire-blue);
  text-decoration: none;
}

.organism-back-row a:hover,
.organism-empty a:hover {
  text-decoration: underline;
}

.organism-hero {
  max-width: 900px;
  margin-bottom: 1.5rem;
}

.organism-eyebrow {
  margin: 0 0 0.25rem;
  color: var(--green);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.organism-hero h1,
.organism-empty h1 {
  margin: 0;
  color: #1a1a18;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}

.organism-id {
  margin: 0.75rem 0 0;
  color: #4a4a47;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  word-break: break-word;
}

.organism-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  width: min(60vw, 100%);
  max-width: 100%;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(30, 30, 20, 0.12);
  background: rgba(30, 30, 20, 0.12);
}

.organism-summary div {
  min-height: 84px;
  padding: 1rem;
  background: #fff;
}

.organism-summary span {
  display: block;
  margin-bottom: 0.4rem;
  color: #6b6a64;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.organism-summary strong {
  color: #1a1a18;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.organism-section {
  max-width: none;
  margin-top: 1.5rem;
}

.organism-section h2 {
  margin: 0 0 0.75rem;
  color: #1a1a18;
  font-size: 1.2rem;
}

.organism-taxonomy {
  max-width: none;
  margin: 0;
  color: #3b3b37;
  line-height: 1.55;
}

.organism-operon {
  display: block;
  box-sizing: border-box;
  width: min(60vw, 100%);
  max-width: 100%;
  padding: 1rem;
  border-radius: 6px;
  background: rgba(19, 28, 46, 0.96);
  overflow-x: auto;
}

.organism-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(30, 30, 20, 0.12);
  background: #fff;
}

.organism-gene-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.organism-gene-table th,
.organism-gene-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(30, 30, 20, 0.1);
  text-align: left;
  vertical-align: top;
}

.organism-gene-table th {
  background: #f0efe9;
  color: #4a4a47;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.organism-gene-table td {
  color: #1a1a18;
  overflow-wrap: anywhere;
}

.organism-muted,
.organism-status,
.organism-empty p {
  color: #4a4a47;
}

footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  width: 100%;
  border-top: 1px solid #ddd;
  background: rgba(225, 225, 225, 0.8);
  min-height: 25px;
  line-height: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
}
footer a:hover {
  text-decoration: underline;
}

#tree-container svg {
  position: relative;
  display: block;
}

.tree-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
}

.tree-header h1 {
  margin: 0;
  line-height: 1.1;
}

.tree-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
}

.tree-search__field,
.tree-search__examples {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tree-search label {
  color: #4a4a47;
  font-size: 20px;
  font-weight: 700;
}

.tree-search input {
  box-sizing: border-box;
  width: 300px;
  max-width: 42vw;
  padding: 6px 10px;
  border: 1px solid rgba(30, 30, 20, 0.16);
  border-radius: 4px;
  background: #fbfeff;
  color: #1a1a18;
  font: inherit;
}

.tree-search__examples {
  color: #5f5f58;
  font-size: 20px;
}

.tree-search__examples span {
  font-weight: 700;
}

.tree-search__examples button {
  padding: 3px 8px;
  border: 1px solid rgba(30, 30, 20, 0.16);
  border-radius: 4px;
  background: #f4f7f2;
  color: #1f4f32;
  cursor: pointer;
  font: inherit;
}

.tree-search__examples button:hover,
.tree-search__examples button:focus {
  border-color: rgba(31, 79, 50, 0.35);
  background: #e9f2e8;
}

.page-description {
  max-width: 640px;
  margin: 0.2rem 0 0.75rem;
  color: #4a4a47;
  font-size: 20px;
  line-height: 1.6;
}

.tree-panel {
  position: relative;
}

#tree-container {
  margin-top: 1rem;
}

.tree-instructions {
  position: absolute;
  top: 2rem;
  right: clamp(1rem, 4vw, 3rem);
  z-index: 5;
  box-sizing: border-box;
  width: min(320px, calc(100% - 2rem));
  padding: 18px 20px;
  border: 1px solid rgba(30, 30, 20, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #4a4a47;
  box-shadow: 0 10px 24px rgba(30, 30, 20, 0.08);
}

.tree-instructions__title {
  margin-bottom: 10px;
  color: var(--green);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tree-instructions p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}

#tooltip {
  position: absolute;
  background: rgba(19, 28, 46, 0.96);
  color: #f6f8fb;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  font-size: 18px;
  line-height: 1.35;
  padding: 10px 12px;
  max-width: 460px;
  display: none;
  pointer-events: none;
  z-index: 1000;
}

.tooltip-card {
  display: grid;
  gap: 8px;
}

.tooltip-title {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.tooltip-subtitle {
  font-size: 15px;
  color: #c8d3e1;
  word-break: break-word;
}

.tooltip-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: start;
}

.tooltip-key {
  color: #a6b7cc;
  font-weight: 600;
  white-space: nowrap;
}

.tooltip-value {
  color: #f6f8fb;
  word-break: break-word;
}

.tooltip-taxonomy-label {
  color: #a6b7cc;
  font-weight: 600;
}

.tooltip-taxonomy {
  color: #e8eef7;
  max-width: 430px;
  word-break: break-word;
}

.tooltip-operon-wrapper {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.tooltip-operon-track {
  position: relative;
  width: 404px;
  max-width: 100%;
  height: 52px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.organism-operon .tooltip-operon-track {
  width: 100%;
  height: 72px;
}

.organism-operon .tooltip-operon-gene {
  top: 29px;
  height: 28px;
  cursor: help;
}

.organism-operon .tooltip-operon-gene-label {
  top: -22px;
  max-width: 140px;
  font-size: 14px;
}

.organism-operon .tooltip-operon-gene-body {
  height: 16px;
}

.organism-operon .tooltip-operon-arrow-forward,
.organism-operon .tooltip-operon-arrow-reverse {
  border-top-width: 8px;
  border-bottom-width: 8px;
}

.organism-operon .tooltip-operon-arrow-forward {
  border-left-width: 12px;
}

.organism-operon .tooltip-operon-arrow-reverse {
  border-right-width: 12px;
}

.organism-operon .tooltip-operon-track::before {
  top: 43px;
}

.organism-operon .tooltip-operon-scale-label {
  font-size: 13px;
}

.organism-gene-tooltip {
  display: none;
  position: fixed;
  z-index: 100;
  max-width: min(420px, calc(100vw - 16px));
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  background: rgba(19, 28, 46, 0.98);
  color: #f6f8fb;
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: none;
  white-space: pre-wrap;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.25);
}

.tooltip-operon-track::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.tooltip-operon-gene {
  position: absolute;
  top: 19px;
  display: flex;
  align-items: center;
  height: 22px;
  min-width: 10px;
}

.tooltip-operon-gene-label {
  position: absolute;
  top: -16px;
  left: 50%;
  max-width: 72px;
  transform: translateX(-50%);
  color: #f6f8fb;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.tooltip-operon-gene-body {
  flex: 1 1 auto;
  height: 12px;
  min-width: 2px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.tooltip-operon-arrow-forward,
.tooltip-operon-arrow-reverse {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.tooltip-operon-arrow-forward {
  border-left: 9px solid;
}

.tooltip-operon-arrow-reverse {
  border-right: 9px solid;
}

.tooltip-operon-scale {
  position: relative;
  height: 22px;
  margin: 4px 8px 0;
}

.tooltip-operon-scale-line {
  position: absolute;
  top: 5px;
  right: 0;
  left: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.tooltip-operon-scale-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.tooltip-operon-scale-tick.start {
  transform: translateX(0);
}

.tooltip-operon-scale-tick.end {
  transform: translateX(-100%);
}

.tooltip-operon-scale-mark {
  width: 1px;
  height: 7px;
  margin: 2px auto 0;
  background: rgba(255, 255, 255, 0.45);
}

.tooltip-operon-scale-label {
  display: block;
  color: #b8c6d8;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.tree-label {
  cursor: pointer;
  fill: black;
}

.tree-label:hover {
  fill: #1f77b4;
  font-weight: bold;
}

.tree-match {
  fill: #f30404;
  font-weight: bold;
}

.tree-dim {
  fill: #ccc;
  opacity: 0.3;
}

@media (max-width: 900px) {
  .tree-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .tree-search {
    width: 100%;
    align-items: stretch;
    margin-left: 0;
  }

  .tree-search__field {
    width: 100%;
  }

  .tree-search input {
    flex: 1;
    max-width: none;
  }

  .tree-search__examples {
    flex-wrap: wrap;
    padding-left: 50px;
  }

  .tree-instructions {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    margin-top: 1rem;
  }
}

/* . class selctor
   # id selector */
