/* Девять органов человека — минималистичная книжная страница */

:root {
  --font-oranienbaum: "Oranienbaum";
  --font-old-standard: "Old Standard TT";
  --font-pt-serif: "PT Serif";
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img,
svg,
video,
canvas {
  display: block;
  vertical-align: middle;
}

img,
video {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   Бумага, чернила, тонкие линейки. Никаких теней, градиентов,
   фактур и переходов — только тёплый книжный фон и воздух.
   ============================================================ */

.root {
  --paper: #f3ebd9;
  --paper-deep: #ece1c8;
  --card: #f6f0e2;
  --ink: #2f2719;
  --ink-soft: #4a4030;
  --ink-faint: #7c6f56;
  --line: #d8cbb0;
  --line-soft: #e4dac4;
  --red: #a52a21;
  --red-deep: #8a231b;

  --font-display: var(--font-oranienbaum), "Old Standard TT", Georgia, serif;
  --font-acad: var(--font-old-standard), "PT Serif", Georgia, serif;
  --font-body: var(--font-pt-serif), Georgia, serif;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-body);
  background-color: var(--paper);
  overflow-x: hidden;
}

/* ==================== ШАПКА ==================== */

.header {
  flex: 0 0 auto;
  text-align: center;
  padding: 28px 24px 8px;
}

.headerTop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.topRule {
  display: block;
  width: min(120px, 12vw);
  height: 1px;
  background: var(--line);
}

.topLabel {
  font-family: var(--font-acad);
  font-size: 10px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}

.headerInner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brandTitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.08;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-wrap: balance;
}

.brandOrn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.ornLine {
  display: block;
  width: min(160px, 16vw);
  height: 1px;
  background: var(--line);
}

.ornStar {
  color: var(--red);
  font-size: 10px;
  line-height: 1;
}

.brandSubtitle {
  margin-top: 12px;
  font-family: var(--font-acad);
  font-size: 11.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ==================== СЕТКА ==================== */

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 30px;
  padding: 10px 30px 0;
  align-items: stretch;
  max-width: 1720px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
}

/* ==================== СЛЕВА: ОРГАНЫ ==================== */

.libraryPanel {
  padding: 2px 0 0;
}

.libraryHead {
  padding: 0 2px 14px;
}

.panelTitle {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-acad);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.titleRule {
  display: block;
  flex: 1 1 auto;
  height: 1px;
  background: var(--line-soft);
}

.organList {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.organList::-webkit-scrollbar {
  width: 4px;
}

.organList::-webkit-scrollbar-thumb {
  background: var(--line);
}

.organEntry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 2px;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: left;
  color: inherit;
}

.organNum {
  flex: 0 0 auto;
  width: 18px;
  font-family: var(--font-acad);
  font-size: 13px;
  color: var(--ink-faint);
  text-align: right;
}

.organThumb {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-deep);
  object-fit: cover;
  padding: 0;
}

.organText {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.organName {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.25;
  color: var(--ink);
}

.organSub {
  font-family: var(--font-acad);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organEntryActive .organNum,
.organEntryActive .organName {
  color: var(--red-deep);
}

/* ==================== ЦЕНТР: СЦЕНА ==================== */

.stageWrap {
  min-width: 0;
  display: flex;
}

.stageFrame {
  position: relative;
  flex: 1 1 auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  overflow: hidden;
  min-height: 480px;
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.stage.dragging {
  cursor: grabbing;
}

.stage.hot {
  cursor: pointer;
}

/* ---------- загрузка ---------- */

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  z-index: 30;
}

.loaderHidden {
  display: none;
}

.loaderCard {
  text-align: center;
  width: 220px;
  padding: 20px 16px;
}

.loaderOrn {
  font-size: 18px;
  color: var(--red);
  margin-bottom: 12px;
}

.loaderLabel {
  font-family: var(--font-acad);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.loaderLabel small {
  display: block;
  margin-top: 8px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--ink-faint);
}

.loaderBar {
  height: 1px;
  background: var(--line);
  overflow: hidden;
}

.loaderFill {
  height: 100%;
  width: 0%;
  background: var(--red);
}

.loaderPct {
  margin-top: 8px;
  font-family: var(--font-acad);
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ---------- подпись к рисунку ---------- */

.stageCaption {
  position: absolute;
  left: 18px;
  bottom: 14px;
  z-index: 10;
  pointer-events: none;
}

.captionName {
  font-family: var(--font-acad);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-faint);
}

/* ---------- маленькая кнопка автовращения в углу ---------- */

.stageControls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
}

.ctlBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink-faint);
  background: transparent;
  border: 0;
}

.ctlBtnActive {
  color: var(--red-deep);
}

/* ==================== СПРАВА: СВЕДЕНИЯ ==================== */

.infoPanel {
  padding: 2px 2px 24px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.infoPanel::-webkit-scrollbar {
  width: 4px;
}

.infoPanel::-webkit-scrollbar-thumb {
  background: var(--line);
}

.infoTitleRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.infoTitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 2.4vw, 36px);
  line-height: 1.1;
  color: var(--ink);
}

.infoPoetic {
  font-family: var(--font-acad);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.infoThumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-deep);
  object-fit: cover;
  padding: 0;
}

.infoMetaLine {
  font-family: var(--font-acad);
  font-size: 12px;
  color: var(--ink-faint);
  margin: 12px 0 14px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}

.latin {
  font-style: italic;
}

.infoDesc {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-soft);
  margin-bottom: 16px;
  text-align: justify;
  hyphens: auto;
}

.infoDivider {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 18px 0 14px;
}

.factsTitle {
  font-family: var(--font-acad);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.facts {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.facts th,
.facts td {
  padding: 7px 8px 7px 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.facts tr:last-child th,
.facts tr:last-child td {
  border-bottom: none;
}

.facts th {
  width: 104px;
  font-family: var(--font-acad);
  font-weight: 400;
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.facts td {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---------- карточка структуры ---------- */

.hsHead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.hsDot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hsKicker {
  font-family: var(--font-acad);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.closeX {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
}

.hsName {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
}

.hsLatin {
  font-family: var(--font-acad);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-faint);
  margin: 4px 0 12px;
}

.hsDesc {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-soft);
  text-align: justify;
  hyphens: auto;
}

.backLink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 0;
  font-family: var(--font-acad);
  font-size: 12.5px;
  color: var(--red-deep);
  background: none;
  border: none;
}

.backLink:hover {
  text-decoration: underline;
}

/* ==================== ПОДВАЛ ==================== */

.footer {
  flex: 0 0 auto;
  text-align: center;
  padding: 20px 20px 24px;
}

.footerLink {
  font-family: var(--font-acad);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
}

.footerLink:hover {
  color: var(--red-deep);
  text-decoration: underline;
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 230px minmax(0, 1fr) 290px;
    gap: 20px;
    padding: 10px 18px 0;
  }
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 10px 16px 0;
  }
  .stageWrap {
    order: 1;
  }
  .libraryPanel {
    order: 2;
    max-height: 320px;
  }
  .infoPanel {
    order: 3;
    max-height: none;
    padding-right: 0;
  }
  .brandTitle {
    font-size: clamp(26px, 7vw, 38px);
  }
  .brandSubtitle {
    font-size: 10px;
    letter-spacing: 0.16em;
  }
  .stageFrame {
    min-height: 56vh;
  }
}


/* ==================== АТЛАС ПРЕПАРАТА ==================== */

.atlasGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin: 16px 0 6px;
}

.atlasItem {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: zoom-in;
  text-align: left;
  color: inherit;
}

.atlasImg {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper-deep);
  padding: 0;
}

.atlasCap {
  font-family: var(--font-acad);
  font-style: italic;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.atlasItem:hover .atlasCap {
  color: var(--red-deep);
  text-decoration: underline;
}

/* ---------- рассматривание рисунка ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(47, 39, 25, 0.55);
}

.lightboxCard {
  position: relative;
  margin: 0;
  width: min(540px, 94vw);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px 16px 14px;
}

.lightboxImg {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  background: var(--paper-deep);
}

.lightboxCap {
  margin-top: 12px;
  font-family: var(--font-acad);
  font-style: italic;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
}

.lightboxClose {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper-deep);
  color: var(--ink-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.lightboxClose:hover {
  color: var(--red-deep);
  border-color: var(--red);
}
