/* cabbithistory.cv — «музейный полевой архив» / museum field archive
   бумага / чернила / плющ / сургуч — paper / ink / ivy / sealing wax */

:root {
  --paper:   #f1ead9;
  --plate:   #f8f3e7;
  --note:    #fbf7ec;
  --ink:     #26221b;
  --ink-soft:#5f5847;
  --ivy:     #40684a;
  --stamp:   #a8492c;

  --display: "Old Standard TT", "Times New Roman", serif;
  --body:    "Golos Text", "Segoe UI", sans-serif;
  --hand:    "Caveat", cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* бумажное зерно поверх всего / paper grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: .55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.07'/></feComponentTransfer></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

::selection { background: var(--ivy); color: var(--plate); }

a { color: var(--ivy); }

:focus-visible {
  outline: 2px dashed var(--stamp);
  outline-offset: 3px;
}

/* ── двуязычность / bilingual ─────────────────── */

html[data-lang="ru"] .en { display: none; }
html[data-lang="en"] .ru { display: none; }

.hand { font-family: var(--hand); }

/* ── шапка-бланк / letterhead ─────────────────── */

.masthead {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.1rem clamp(1.25rem, 5vw, 4rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 3px double var(--ink);
}

.mark {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .01em;
}

.masthead-note {
  margin: 0;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* переключатель языка — как архивный ярлычок / language switch as an archive tag */
.lang {
  display: inline-flex;
  border: 1px solid var(--ink);
  background: var(--plate);
  box-shadow: 2px 2px 0 rgba(38, 34, 27, .12);
}

.lang button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: .3rem .7rem;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--body);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  cursor: pointer;
  transition: background-color .25s, color .25s, translate .12s;
}

.lang button + button { border-left: 1px solid var(--ink); }

.lang button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--plate);
}

.lang button:hover:not([aria-pressed="true"]) { background: rgba(38, 34, 27, .08); }

/* ── таблица экземпляра / specimen plate ──────── */

.specimen {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.specimen > * { min-width: 0; }

/* корешок архивной папки / archive folder spine */
.spine {
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-size: .85rem;
  letter-spacing: .22em;
  color: var(--ink-soft);
  opacity: .75;
}

.plate {
  margin: 0;
  padding: clamp(.9rem, 2vw, 1.4rem);
  background: var(--plate);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 6px;
  box-shadow: 10px 12px 0 rgba(38, 34, 27, .08);
}

.photo {
  position: relative;
  border: 1px solid var(--ink);
  background: #fff;
  overflow: hidden;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
}

/* фотоуголки, как в альбоме / photo corners, album style */
.corner {
  position: absolute;
  z-index: 2;
  width: 34px;
  height: 34px;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(38, 34, 27, .82) 0 46%, transparent 47%);
}

.corner.tr { top: 0; right: 0;    transform: scaleX(-1); }
.corner.bl { bottom: 0; left: 0;  transform: scaleY(-1); }
.corner.br { bottom: 0; right: 0; transform: scale(-1); }

/* метки-выноски без цифр: кольцо + рукописная подпись / number-free hotspots */
.spot {
  position: absolute;
  z-index: 3;
  left: var(--x);
  top: var(--y);
  translate: -50% -50%;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.spot::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1.5px solid rgba(248, 243, 231, .95);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(38, 34, 27, .55), 0 1px 3px rgba(38, 34, 27, .4);
  transition: inset .25s cubic-bezier(.2, .7, .2, 1);
}

/* пульс-приглашение / inviting pulse */
.spot::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(248, 243, 231, .8);
  border-radius: 50%;
  animation: ping 3.2s ease-out infinite;
}

.spot:hover::before,
.spot:focus-visible::before,
.spot[aria-expanded="true"]::before { inset: 5px; }

.spot-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  translate: -50% 4px;
  width: max-content;
  max-width: 190px;
  padding: .35rem .7rem .45rem;
  background: var(--note);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(38, 34, 27, .15);
  font-size: 1.12rem;
  line-height: 1.2;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, translate .3s cubic-bezier(.16, 1, .3, 1);
}

/* хвостик подписи / little tail */
.spot-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  translate: -50% 0;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}

.spot:hover .spot-tip,
.spot:focus-visible .spot-tip,
.spot[aria-expanded="true"] .spot-tip {
  opacity: 1;
  translate: -50% 0;
}

/* правым меткам подпись прижата вправо, чтобы не уходить за кадр / right-side spots keep tips inside */
.spot[style*="--x:7"] .spot-tip {
  left: auto;
  right: -10px;
  translate: 0 4px;
}

.spot[style*="--x:7"]:hover .spot-tip,
.spot[style*="--x:7"]:focus-visible .spot-tip,
.spot[style*="--x:7"][aria-expanded="true"] .spot-tip {
  translate: 0 0;
}

.spot[style*="--x:7"] .spot-tip::after {
  left: auto;
  right: 18px;
  translate: 0 0;
}

.cap {
  margin: 1rem 0 .9rem;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem 1.6rem;
  font-family: var(--hand);
  font-size: 1.22rem;
  line-height: 1.3;
}

.legend li { position: relative; padding-left: 1.1rem; }

.legend li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: .65rem;
  border-top: 1.5px solid var(--ivy);
}

/* ── паспорт экземпляра / dossier ─────────────── */

.kicker {
  margin: 0 0 1.1rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--stamp);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.7rem, 5.4vw, 4.4rem);
  line-height: .95;
  letter-spacing: -.01em;
}

.latin {
  margin: .7rem 0 0;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  color: var(--ivy);
}

.lead {
  margin: 1.1rem 0 1.6rem;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.taxa { margin: 0; }

.taxa div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .48rem 0;
  border-bottom: 1px dotted rgba(38, 34, 27, .4);
}

.taxa dt {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.taxa dd {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  text-align: right;
}

/* сургучная печать: вбивается при появлении / stamp slams in on reveal */
.stamp {
  display: inline-block;
  max-width: 100%;
  margin: 1.7rem 0 0;
  padding: .45em .9em;
  border: 2px solid var(--stamp);
  color: var(--stamp);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  mix-blend-mode: multiply;
  opacity: 0;
  transform: rotate(-14deg) scale(1.9);
}

.stamp.stamped {
  animation: slam .5s cubic-bezier(.2, 1.4, .4, 1) forwards;
}

/* ── хроника / chronicle ──────────────────────── */

.chronicle,
.notes,
.faq {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) clamp(3rem, 7vw, 5rem);
}

h2 {
  margin: 0 0 1.8rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

h2::after {
  content: "";
  display: block;
  width: 72px;
  margin-top: .55rem;
  border-top: 3px double var(--ink);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 clamp(1.2rem, 3vw, 2rem);
  position: relative;
}

/* линия времени прорисовывается / the line draws itself */
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.4s cubic-bezier(.2, .7, .2, 1) .2s;
}

.timeline.in::before { transform: scaleY(1); }

.timeline li {
  position: relative;
  padding: 0 0 1.6rem 1.4rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1 * clamp(1.2rem, 3vw, 2rem) + 0px);
  top: .5em;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.t-date {
  margin: 0 0 .2rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .04em;
}

.t-text {
  margin: 0;
  max-width: 52ch;
  color: var(--ink-soft);
}

/* ── полевые заметки / field notes ────────────── */

.note-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.6rem;
}

.note {
  position: relative;
  padding: 2.3rem 1.4rem 1.2rem;
  background: var(--note);
  border: 1px solid rgba(38, 34, 27, .28);
  box-shadow: 3px 4px 0 rgba(38, 34, 27, .09);
  transform: rotate(var(--r));
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s;
}

.note:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 5px 7px 0 rgba(38, 34, 27, .12);
}

.n1 { --r: -1.6deg; }
.n2 { --r: 1.1deg; }
.n3 { --r: -.7deg; }

/* кусочек архивного скотча / archive tape */
.note::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 86px;
  height: 22px;
  translate: -50% 0;
  rotate: -2deg;
  background: rgba(233, 224, 203, .92);
  border: 1px solid rgba(38, 34, 27, .14);
}

.note p {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.4rem;
  line-height: 1.28;
}

.note > span {
  display: block;
  margin-top: .9rem;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ── вопросы учёного совета / council Q&A ─────── */

.faq-list { max-width: 720px; }

.faq details {
  border-bottom: 1px dotted rgba(38, 34, 27, .4);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .9rem 0;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  font-family: var(--display);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--stamp);
  transition: transform .3s cubic-bezier(.2, .7, .2, 1);
}

.faq details[open] summary::after { transform: rotate(45deg); }

.faq details p {
  margin: 0 0 1rem;
  max-width: 56ch;
  color: var(--ink-soft);
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.3;
}

/* ── подвал / colophon ────────────────────────── */

.colophon { border-top: 3px double var(--ink); }

.colophon p {
  max-width: 1180px;
  margin: 0 auto;
  padding: .5rem clamp(1.25rem, 5vw, 4rem);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.colophon p:first-child { padding-top: 1.4rem; }
.colophon p:last-child  { padding-bottom: 1.6rem; }

/* ── курсор-котокролик / cabbit cursor ────────── */

/* ── появление при скролле / scroll reveal ───── */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1);
}

[data-reveal].in {
  opacity: 1;
  transform: none;
}

.note-list [data-reveal].in { transform: rotate(var(--r)); }
.note-list [data-reveal].in:hover { transform: rotate(0deg) translateY(-4px); }

/* ── движение / motion ────────────────────────── */

@keyframes ping {
  0%   { transform: scale(1);   opacity: .9; }
  70%  { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}

@keyframes slam {
  0%   { opacity: 0; transform: rotate(-14deg) scale(1.9); }
  60%  { opacity: 1; transform: rotate(-4deg)  scale(.96); }
  100% { opacity: .92; transform: rotate(-5deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; }
  .stamp { opacity: .92; transform: rotate(-5deg) scale(1); }
  .timeline::before { transform: scaleY(1); }
}

/* ── узкие экраны / narrow screens ────────────── */

@media (max-width: 900px) {
  .specimen { grid-template-columns: minmax(0, 1fr); }
  .spine { display: none; }
  .legend { grid-template-columns: 1fr; }
  .lead { max-width: none; }
  .masthead { align-items: flex-start; }
  .masthead-note { order: 3; width: 100%; }
}

/* ── микродвижения: нажатие, подтверждение осмотра ── */
/* micro-motion: button press, inspection confirm */

/* подсказка «осмотри метки» гаснет после полного осмотра / hint fades after full inspection */
.hint {
  margin: .6rem 0 0;
  font-size: 1.1rem;
  color: var(--ink-soft);
  transition: opacity .4s;
}
.hint.done { opacity: .5; }

/* ответы совета распахиваются мягко / faq answers pop open softly */
.faq details[open] p { animation: faqIn .32s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes faqIn {
  from { opacity: 0; translate: 0 -5px; }
  to   { opacity: 1; translate: 0 0; }
}

/* языковые кнопки вжимаются / language buttons press in */
.lang button:active { translate: 0 1px; }

/* ── каталог видов / species catalog ────────────── */

.species {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) clamp(3rem, 7vw, 5rem);
}

.species-sub {
  margin: -.4rem 0 1.8rem;
  font-size: 1.15rem;
  color: var(--ink-soft);
}

.species-grid {
  display: flex;
  gap: clamp(1rem, 2.5vw, 1.6rem);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-padding-left: 2px;
  padding: 6px 6px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-soft) transparent;
}

.species-grid::-webkit-scrollbar { height: 6px; }
.species-grid::-webkit-scrollbar-thumb { background: var(--ink-soft); border-radius: 3px; }
.species-grid::-webkit-scrollbar-track { background: transparent; }

.plate-mini {
  flex: 0 0 min(44%, 330px);
  scroll-snap-align: start;
  margin: 0;
  padding: clamp(.8rem, 1.6vw, 1.1rem);
  background: var(--plate);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 5px;
  box-shadow: 8px 9px 0 rgba(38, 34, 27, .08);
  transition: translate .35s cubic-bezier(.16, 1, .3, 1), box-shadow .35s;
}

.plate-mini:hover {
  translate: 0 -5px;
  box-shadow: 12px 15px 0 rgba(38, 34, 27, .13);
}

.rail-nav {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  padding: 0 6px;
}

.rail-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  background: var(--plate);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(38, 34, 27, .12);
  transition: background-color .2s, translate .15s;
}

.rail-btn:hover { background: rgba(38, 34, 27, .08); }
.rail-btn:active { translate: 0 1px; }

.plate-no {
  margin: 0 0 .55rem;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.pm-photo {
  border: 1px solid var(--ink);
  background: #fff;
  overflow: hidden;
}

.pm-photo img {
  display: block;
  width: 100%;
  height: auto;
  filter: sepia(.14) saturate(.94);
  transition: filter .5s cubic-bezier(.16, 1, .3, 1);
}

/* фото «оживает» при наведении: архивная сепия снимается */
.plate-mini:hover .pm-photo img { filter: none; }

.pm-name {
  margin: .75rem 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.2;
}

.pm-latin {
  margin: .15rem 0 .4rem;
  font-family: var(--display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
}

.pm-line {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .plate-mini { flex-basis: 78%; }
}
