:root {
  --bg0: #f3f1ec;
  --bg1: #e8eef4;
  --ink: #1a2333;
  --muted: #66758a;
  --line: #d5dde8;
  --react: #1f4e79;
  --prod: #1a5c45;
  --arrow: #c45c26;
  --card: #fff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dfe9f5 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f0e6d8 0%, transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}
.ev-top {
  max-width: min(1180px, 96vw);
  margin: 0 auto;
  padding: 1.6rem 1.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}
.ev-top__mid { flex: 1 1 14rem; min-width: 0; }
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.lang-switch__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.lang-select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2366758a' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.2 0 2.3z'/%3E%3C/svg%3E")
    no-repeat right 0.65rem center;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.38rem 1.85rem 0.38rem 0.7rem;
  min-width: 7.5rem;
  cursor: pointer;
}
.lang-select:hover,
.lang-select:focus {
  border-color: var(--arrow);
  outline: none;
}
.ev-brand {
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ev-top h1 {
  margin: 0.45rem 0 0.25rem;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 700;
}
.ev-sub { margin: 0; color: var(--muted); font-size: 0.92rem; }
.ev-main {
  max-width: min(1280px, 96vw);
  margin: 0 auto;
  padding: 0.75rem 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ev-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}
.ev-content {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}
@media (max-width: 860px) {
  .ev-layout { grid-template-columns: 1fr; }
}
.ev-loading, .ev-empty {
  color: var(--muted);
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
}

.eq-toc {
  position: sticky;
  top: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.9rem 1rem;
  box-shadow: 0 8px 22px rgba(26, 35, 51, 0.05);
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
}
.eq-toc__title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.eq-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.eq-toc__list a {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.4rem;
  align-items: start;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
}
.eq-toc__list a:hover {
  background: #eef3f9;
  color: var(--react);
}
.eq-toc__n {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.75rem;
  padding-top: 0.08rem;
}
.eq-toc__label {
  word-break: break-word;
}
@media (max-width: 860px) {
  .eq-toc {
    position: static;
    max-height: none;
  }
  .eq-toc__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.25rem;
  }
}

.eq-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 10px 28px rgba(26, 35, 51, 0.06);
  animation: evRise 0.4s ease both;
  overflow: visible;
  scroll-margin-top: 0.85rem;
}
.eq-card__details { margin: 0; }
.eq-card__summary {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "badge file"
    "title title";
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.95rem 1.15rem;
  cursor: pointer;
  list-style: none;
}
.eq-card__summary::-webkit-details-marker { display: none; }
.eq-card__summary::after {
  content: "";
  grid-column: 1 / -1;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  justify-self: end;
  margin-top: -1.6rem;
  opacity: 0.7;
  transition: transform 0.15s ease;
}
.eq-card__details[open] > .eq-card__summary::after {
  transform: rotate(-135deg);
  margin-top: -1.35rem;
}
.eq-card__badge {
  grid-area: badge;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--react);
  background: #e8f0f8;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}
.eq-card__title {
  grid-area: title;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  padding-right: 1.25rem;
  line-height: 1.35;
}
.eq-card__file {
  grid-area: file;
  color: var(--muted);
  font-size: 0.78rem;
  justify-self: end;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eq-card__body {
  padding: 0.2rem 1.15rem 1.35rem;
  border-top: 1px solid #eef2f7;
  overflow: visible;
}
.eq-card__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.85rem;
  padding: 1.1rem 1.2rem 0;
}
.eq-gallery .eq-card__head { padding: 0; }
.eq-gallery {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 10px 28px rgba(26, 35, 51, 0.06);
}

.eq-biblio {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.15rem 1.1rem;
  box-shadow: 0 10px 28px rgba(26, 35, 51, 0.06);
  margin-bottom: 0.15rem;
}
.eq-biblio__title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.eq-biblio__list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.eq-biblio__row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
}
.eq-biblio__row dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  padding-top: 0.1rem;
}
.eq-biblio__row dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}
.eq-biblio__row a {
  color: #1f4e79;
  text-decoration: underline;
  text-underline-offset: 2px;
}
@media (max-width: 560px) {
  .eq-biblio__row { grid-template-columns: 1fr; gap: 0.15rem; }
}
.eq-loc-row {
  margin: -0.35rem 0 0.55rem;
}
.eq-loc {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #3d5670;
  background: #e8f0f8;
  border: 1px solid #c9d9ea;
  border-radius: 6px;
  padding: 0.18rem 0.45rem;
  line-height: 1.35;
  cursor: help;
  max-width: 100%;
  word-break: break-word;
}
.eq-conds .eq-loc {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.66rem;
  font-weight: 550;
  background: #f3f7fb;
}
.eq-cond-bar > .eq-loc {
  margin: 0 0 0.45rem;
}

.eq-scheme {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 0.95rem;
}
@media (max-width: 720px) {
  .eq-scheme { grid-template-columns: 1fr; }
  .eq-arrow { transform: rotate(90deg); justify-self: center; }
}
.eq-side {
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  min-height: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.eq-side--react {
  background: linear-gradient(160deg, #eaf2fb, #f7fafc);
  border: 1px solid #c9daf0;
}
.eq-side--prod {
  background: linear-gradient(160deg, #e8f5ef, #f7fcf9);
  border: 1px solid #b9dfcd;
}
.eq-side__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}
.eq-side--react .eq-side__label { color: var(--react); }
.eq-side--prod .eq-side__label { color: var(--prod); }
.eq-side__text {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}
.eq-structs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}
.eq-mol {
  margin: 0;
  text-align: center;
  max-width: 100%;
}
.eq-mol img {
  display: block;
  width: min(100%, 260px);
  height: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
}
.eq-mol figcaption {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
  word-break: break-word;
}
.eq-gallery {
  background: var(--card, #fff);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 8px 28px rgba(30, 50, 80, 0.06);
}
.eq-scheme-fig {
  margin: 0.55rem 0 0;
  text-align: center;
  overflow: visible;
  max-width: 100%;
}
.eq-scheme-fig figcaption {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink, #1a2a3a);
  margin-bottom: 0.4rem;
  text-align: left;
}
.eq-scheme-fig img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  /* Do not cap tall BJOC schemes — max-height was making dense art look cropped */
  max-height: none;
  object-fit: contain;
  object-position: center top;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: zoom-in;
}
.eq-scheme-fig a.eq-scheme-fig__link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.eq-gallery__item {
  overflow: visible;
}
.eq-gallery__item .eq-scheme-fig img {
  max-width: 100%;
}
.eq-arrow {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--arrow);
  font-weight: 700;
  min-width: 3.2rem;
}
.eq-arrow svg { width: 42px; height: 18px; }
.eq-arrow span { font-size: 0.72rem; letter-spacing: 0.04em; }

.eq-cond-bar {
  margin: 0.65rem 0 0.35rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #f7fafc, #eef3f8);
  border: 1px solid #d7e2ee;
}
.eq-cond-bar[data-matched="1"] {
  border-color: #b9d0e8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.eq-cond-bar--empty {
  background: #fafafa;
  border-style: dashed;
}
.eq-cond-bar__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.eq-cond-bar__empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.eq-conds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.eq-conds li {
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.86rem;
  line-height: 1.35;
  border: 1px solid rgba(0,0,0,0.04);
}
.eq-conds strong {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 0.1rem;
}
.eq-gallery__item {
  margin-top: 0.75rem;
}
.eq-gallery__item .eq-cond-bar {
  margin-top: 0.45rem;
}
.eq-sec { margin-top: 0.95rem; scroll-margin-top: 0.85rem; }
.eq-sec:first-child { margin-top: 0.85rem; }
.eq-sec__title,
.eq-sec__label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid #e8eef5;
  padding-bottom: 0.3rem;
}
.eq-list { margin: 0; padding-left: 1.15rem; font-size: 0.88rem; line-height: 1.45; }
.eq-list li + li { margin-top: 0.25rem; }
.eq-notes { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.82rem; }

@keyframes evRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
