/* =========================================================================
   Anatomy Atlas - presentation layer
   Every rule is scoped inside .atlas-root, so nothing here can affect a
   surrounding site header, footer or global stylesheet.
   To restyle, change the custom properties in the :root block below.
   ========================================================================= */

:root {
  /* ---- the two things you are most likely to change ---- */
  --atlas-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --atlas-font-heading: var(--atlas-font);

  /* ---- brand accent: RGB 232 225 0 ---- */
  --atlas-accent: rgb(232, 225, 0);
  --atlas-accent-strong: rgb(206, 200, 0);
  --atlas-accent-ink: #1a1a17;

  /* ---- neutrals ---- */
  --atlas-bg: #ffffff;
  --atlas-surface: #ffffff;
  --atlas-surface-2: #f6f6f3;
  --atlas-line: #dcddd8;
  --atlas-line-strong: #b9bab4;
  --atlas-ink: #16181a;
  --atlas-ink-2: #494e54;
  --atlas-ink-3: #6c727a;
  --atlas-focus: #16181a;

  /* ---- metrics ---- */
  --atlas-height: 780px;
  --atlas-rail-width: 300px;
  --atlas-panel-width: 400px;
  --atlas-radius: 4px;
}

.atlas-root {
  font-family: var(--atlas-font);
  color: var(--atlas-ink);
  background: var(--atlas-bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
.atlas-root *, .atlas-root *::before, .atlas-root *::after { box-sizing: border-box; }
.atlas-root button, .atlas-root input { font: inherit; color: inherit; }

.atlas-root :focus-visible {
  outline: 2px solid var(--atlas-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--atlas-accent);
  border-radius: 2px;
}
.atlas-root :focus:not(:focus-visible) { outline: none; }

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

/* ---------- frame ---------- */

.atlas-app {
  display: grid;
  grid-template-columns: var(--atlas-rail-width) 1fr;
  grid-template-rows: auto 1fr;
  height: var(--atlas-height);
  min-height: 520px;
  border: 1px solid var(--atlas-line);
  border-radius: var(--atlas-radius);
  overflow: hidden;
  background: var(--atlas-surface);
}

#top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--atlas-line);
  background: var(--atlas-surface);
}
#top .brand h1 {
  font-family: var(--atlas-font-heading);
  font-size: 19px; line-height: 1.15; margin: 0; font-weight: 700;
  letter-spacing: -0.01em;
}
#top .brand #brandsub {
  display: block; font-size: 12.5px; color: var(--atlas-ink-3); margin-top: 2px;
}
#top .brand { border-left: 4px solid var(--atlas-accent); padding-left: 12px; }
.topbtns { margin-left: auto; display: flex; gap: 8px; }

.tbtn, .vbtn, .preset button, #pclose, #mclose, #clearsearch, #isolatebtn, #deepbtn {
  background: var(--atlas-surface);
  border: 1px solid var(--atlas-line-strong);
  border-radius: var(--atlas-radius);
  padding: 7px 13px;
  cursor: pointer;
  color: var(--atlas-ink);
  transition: background 120ms, border-color 120ms;
}
.tbtn:hover, .vbtn:hover, .preset button:hover, #isolatebtn:hover, #deepbtn:hover {
  background: var(--atlas-surface-2);
  border-color: var(--atlas-ink-3);
}
.tbtn { font-weight: 600; font-size: 13.5px; }
#notesbtn, #deepbtn {
  background: var(--atlas-accent);
  border-color: var(--atlas-accent-strong);
  color: var(--atlas-accent-ink);
  font-weight: 600;
}
#notesbtn:hover, #deepbtn:hover { background: var(--atlas-accent-strong); }
#railtoggle { display: none; }

/* ---------- search ---------- */

#searchwrap { position: relative; flex: 1 1 380px; max-width: 520px; }
#search {
  width: 100%;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--atlas-line-strong);
  border-radius: var(--atlas-radius);
  background: var(--atlas-surface);
  font-size: 14px;
  -webkit-appearance: none; appearance: none;
}
#search::placeholder { color: var(--atlas-ink-3); }
#search:focus { border-color: var(--atlas-ink); }
#clearsearch {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; font-size: 20px; line-height: 1;
  padding: 2px 7px; color: var(--atlas-ink-2);
}
#results {
  display: none; position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 340px; overflow-y: auto;
  background: var(--atlas-surface);
  border: 1px solid var(--atlas-line-strong);
  border-radius: var(--atlas-radius);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}
#results.on { display: block; }
#results button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--atlas-line);
  font-size: 14px;
}
#results button:last-child { border-bottom: 0; }
#results button:hover, #results button:focus { background: var(--atlas-accent); color: var(--atlas-accent-ink); }
#results .ct { display: block; font-size: 12px; color: var(--atlas-ink-3); }
#results button:hover .ct, #results button:focus .ct { color: var(--atlas-accent-ink); }

/* ---------- rail ---------- */

#rail {
  overflow-y: auto;
  border-right: 1px solid var(--atlas-line);
  background: var(--atlas-surface-2);
  padding-bottom: 24px;
}
.railsec { padding: 14px 16px; border-bottom: 1px solid var(--atlas-line); }
.railsec h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--atlas-ink-3); margin: 0 0 10px; font-weight: 700;
}
.preset { display: flex; flex-wrap: wrap; gap: 6px; }
.preset button { font-size: 13px; padding: 6px 11px; }
.preset button[aria-pressed="true"] {
  background: var(--atlas-accent); border-color: var(--atlas-accent-strong);
  color: var(--atlas-accent-ink); font-weight: 600;
}
.sysrow {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: none; padding: 6px 4px; cursor: pointer;
  text-align: left; font-size: 13.5px; border-radius: 2px;
}
.sysrow:hover { background: rgba(0, 0, 0, 0.045); }
.sysrow .sw {
  width: 13px; height: 13px; flex: 0 0 13px; border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.28);
}
.sysrow .nm { flex: 1; }
.sysrow .ct { color: var(--atlas-ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.sysrow[aria-pressed="false"] .nm, .sysrow[aria-pressed="false"] .ct { color: var(--atlas-ink-3); text-decoration: line-through; }
#partlist .partbtn { padding-left: 4px; }
#partlist .partbtn[aria-current="true"] {
  background: var(--atlas-accent); color: var(--atlas-accent-ink); font-weight: 600;
}
.hint { font-size: 12.5px; color: var(--atlas-ink-2); margin: 0; }

/* ---------- stage ---------- */

#stage { position: relative; background: var(--atlas-bg); overflow: hidden; }
#stage canvas { display: block; width: 100%; height: 100%; }
#loading, #nowebgl {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--atlas-ink-2); font-size: 14px; text-align: center; padding: 32px;
  background: var(--atlas-bg); z-index: 5;
}
#nowebgl { display: none; flex-direction: column; gap: 10px; }
#nowebgl p { margin: 0; max-width: 46ch; }
#tip {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12.5px; color: var(--atlas-ink-2);
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--atlas-line);
  border-radius: 999px; padding: 5px 14px; pointer-events: none; z-index: 4;
}
#tag {
  position: absolute; pointer-events: none; z-index: 6; display: none;
  background: var(--atlas-ink); color: #fff; font-size: 12.5px;
  padding: 4px 9px; border-radius: 3px; white-space: nowrap;
}
#tag.on { display: block; }
#hud {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--atlas-line);
}
.slwrap { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--atlas-ink-2); }
.slwrap input[type="range"] { width: 132px; }
#viewbtns { margin-left: auto; display: flex; gap: 6px; }
.vbtn { font-size: 12.5px; padding: 5px 11px; }

.atlas-root input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 20px; }
.atlas-root input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--atlas-line-strong); border-radius: 2px; }
.atlas-root input[type="range"]::-moz-range-track { height: 3px; background: var(--atlas-line-strong); border-radius: 2px; }
.atlas-root input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6.5px;
  background: var(--atlas-accent); border: 1px solid var(--atlas-ink); border-radius: 50%; cursor: pointer;
}
.atlas-root input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; background: var(--atlas-accent);
  border: 1px solid var(--atlas-ink); border-radius: 50%; cursor: pointer;
}

/* ---------- profile panel ---------- */

#panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--atlas-panel-width);
  max-width: 92%; background: var(--atlas-surface);
  border-left: 1px solid var(--atlas-line);
  box-shadow: -10px 0 26px rgba(0, 0, 0, 0.07);
  transform: translateX(100%); transition: transform 200ms ease;
  display: flex; flex-direction: column; z-index: 10;
}
#panel.on { transform: none; }
.phead { position: relative; padding: 18px 52px 14px 20px; border-bottom: 1px solid var(--atlas-line); }
.phead h2 { font-family: var(--atlas-font-heading); font-size: 21px; margin: 4px 0 2px; font-weight: 700; }
.psys { display: flex; align-items: center; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--atlas-ink-3); }
.psys .sw { width: 11px; height: 11px; border-radius: 2px; border: 1px solid rgba(0, 0, 0, 0.28); }
.lat { font-style: italic; color: var(--atlas-ink-3); font-size: 13.5px; }
#pclose, #mclose {
  position: absolute; top: 12px; right: 14px; border: 0; background: transparent;
  font-size: 24px; line-height: 1; padding: 3px 9px; color: var(--atlas-ink-2); cursor: pointer;
}
.pbodywrap { overflow-y: auto; padding: 16px 20px 22px; flex: 1; }
.pbodywrap h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--atlas-ink-3); margin: 18px 0 7px; font-weight: 700;
}
.pbodywrap p { margin: 0 0 10px; color: var(--atlas-ink-2); }
.pbodywrap p:first-child { color: var(--atlas-ink); }
ul.facts { margin: 0; padding-left: 18px; }
ul.facts li { margin-bottom: 6px; color: var(--atlas-ink-2); }
.pfoot { padding: 12px 20px; border-top: 1px solid var(--atlas-line); display: flex; gap: 8px; }

/* ---------- disease modal ---------- */

#modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(22, 24, 26, 0.45);
}
#modal.on { display: flex; }
#modal .sheet {
  background: var(--atlas-surface); width: 100%; max-width: 780px; max-height: 88vh;
  border-radius: var(--atlas-radius); display: flex; flex-direction: column;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.3);
}
.shead { position: relative; padding: 20px 56px 15px 24px; border-bottom: 1px solid var(--atlas-line); }
.shead h2 { font-family: var(--atlas-font-heading); font-size: 22px; margin: 0 0 2px; font-weight: 700; }
.sbody { overflow-y: auto; padding: 6px 24px 24px; }
.sbody h3 { font-family: var(--atlas-font-heading); font-size: 16px; margin: 20px 0 4px; }
.dz { border-left: 3px solid var(--atlas-accent); padding: 2px 0 2px 15px; margin: 20px 0; }
.dz .cause { color: var(--atlas-ink-2); margin: 2px 0 10px; }
.dz h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--atlas-ink-3); margin: 12px 0 5px; font-weight: 700;
}
.dz ul { margin: 0; padding-left: 18px; }
.dz li { margin-bottom: 4px; color: var(--atlas-ink-2); }
.callout {
  background: var(--atlas-surface-2); border: 1px solid var(--atlas-line);
  border-left: 3px solid var(--atlas-ink-3);
  padding: 10px 14px; margin: 12px 0 0; font-size: 13.5px; color: var(--atlas-ink-2);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; }
.refs a { color: var(--atlas-ink); text-decoration: underline; text-decoration-color: var(--atlas-accent-strong); text-underline-offset: 3px; }
.refs a:hover { background: var(--atlas-accent); }

/* ---------- disclaimer ---------- */

.atlas-legal {
  margin: 14px 2px 0; font-size: 12.5px; line-height: 1.55; color: var(--atlas-ink-3);
  max-width: 92ch;
}
.atlas-legal strong { color: var(--atlas-ink-2); }

/* ---------- small screens ---------- */

#railscrim { display: none; }

@media (max-width: 900px) {
  :root { --atlas-height: 640px; }
  .atlas-app { grid-template-columns: 1fr; }
  #railtoggle { display: inline-block; }
  #top { flex-wrap: wrap; }
  #searchwrap { order: 3; flex-basis: 100%; max-width: none; }
  #rail {
    position: absolute; z-index: 60; top: 0; bottom: 0; left: 0; width: 86%; max-width: 340px;
    transform: translateX(-100%); transition: transform 200ms ease;
    box-shadow: 8px 0 26px rgba(0, 0, 0, 0.16);
  }
  #rail.on { transform: none; }
  #railscrim { display: block; position: absolute; inset: 0; z-index: 50; background: rgba(22, 24, 26, 0.4); opacity: 0; pointer-events: none; transition: opacity 180ms; }
  #railscrim.on { opacity: 1; pointer-events: auto; }
  .atlas-app { position: relative; }
  #panel { width: 100%; max-width: none; top: auto; height: 74%; transform: translateY(100%); border-left: 0; border-top: 1px solid var(--atlas-line); }
  #panel.on { transform: none; }
  #tip { display: none; }
  .slwrap input[type="range"] { width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-root * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .atlas-app { height: auto; display: block; }
  #stage, #hud, #rail, #modal, #railscrim { display: none !important; }
}
