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

html {
  font-family: verdana, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  overflow: hidden;
}

svg {
  background: white;
}

.graph {
  border: solid #666 1px;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: white;
  flex-grow: 1;
  overflow: hidden;
  touch-action: manipulation;
}

#loading,
#chart {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#loading {
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chart-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  padding: 0.5rem 0.75rem;
  padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
  gap: 0.5rem;
  border-bottom: 1px solid #ccc;
  background: #f8f8f8;
}

.chart-toolbar-zoom {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
  align-items: center;
}

.graph-zoom-btn {
  box-sizing: border-box;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  font-family: inherit;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 600;
  border: 1px solid #888;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.graph-zoom-btn:active:not(:disabled) {
  background: #eee;
}

.graph-zoom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.graph-zoom-btn:focus-visible {
  outline: 2px solid #448;
  outline-offset: 2px;
}

.chart-search-wrap {
  position: relative;
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 28rem;
  margin-left: auto;
}

.grandtree-search {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid #888;
  border-radius: 6px;
  background: #fff;
}

.grandtree-search:focus-visible {
  outline: 2px solid #448;
  outline-offset: 1px;
}

.grandtree-search-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: min(40vh, 16rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #888;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.grandtree-search-results[hidden] {
  display: none !important;
}

.grandtree-search-results li {
  padding: 0.45rem 0.65rem;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.grandtree-search-results li:last-child {
  border-bottom: none;
}

.grandtree-search-results li:hover,
.grandtree-search-results li:focus,
.grandtree-search-results li[aria-selected="true"] {
  background: #e8f0fe;
}

.grandtree-search-results .search-meta {
  display: block;
  font-size: 11px;
  color: #555;
  margin-top: 0.15rem;
}

.zoom-toggle {
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid #888;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.zoom-toggle:active {
  background: #eee;
}

.zoom-toggle[aria-pressed="true"] {
  background: #e8f0fe;
  border-color: #448;
}

.zoom-toggle:focus-visible {
  outline: 2px solid #448;
  outline-offset: 2px;
}

footer {
  flex-shrink: 0;
}

.site-footer {
  text-align: center;
  padding: 0.5rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}

.node {
  cursor: pointer;
}

.container {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  overflow: auto;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: white;
  border: 1px solid silver;
  /* Pan the chart only; omit pinch-zoom so mobile pinch does not zoom the whole page */
  touch-action: pan-x pan-y;
  -webkit-tap-highlight-color: transparent;
}

/* Padding (set in JS) replaces SVG translate so scrollWidth/scrollHeight include the full graph */
.graph-scroll-inner {
  display: inline-block;
  vertical-align: top;
  line-height: 0;
}

/* Family tree SVG: dimensions come from graph.js; allow panning without text selection */
#graph {
  display: block;
  flex-shrink: 0;
  max-width: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x pan-y;
}

#graph .detailed {
  cursor: pointer;
}

#contact {
  font-size: 12px;
  color: silver;
  padding-top: 10px;
  left: 0;
  right: 0;
  bottom: 2%;
  text-align: center;
}

#released {
  font-size: 12px;
  color: silver;
  padding-top: 10px;
  left: 0;
  right: 0;
  bottom: 2%;
  text-align: center;
}

#quicklink {
  font-size: 11px;
  color: silver;
  padding-top: 10px;
  left: 0;
  right: 0;
  bottom: 2%;
  text-align: center;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

#git {
  font-size: 8px;
  color: silver;
  padding-top: 10px;
  left: 0;
  right: 0;
  bottom: 2%;
  text-align: center;
}

#start {
  text-align: center;
}

@media (max-width: 480px) {
  #quicklink {
    font-size: 10px;
  }

  #released {
    font-size: 11px;
  }
}
