/* /pdd/pravila/ — reader for pdd_rules_ru.json + unified handbook modes */

.hb-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.hb-modes__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.hb-modes__btn:hover {
  background: rgba(90, 168, 255, 0.14);
}

.hb-modes__btn.is-active {
  background: rgba(90, 168, 255, 0.22);
  border-color: rgba(90, 168, 255, 0.45);
}

html[data-theme="light"] .hb-modes__btn {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(32, 27, 18, 0.12);
}

html[data-theme="light"] .hb-modes__btn:hover,
html[data-theme="light"] .hb-modes__btn.is-active {
  background: rgba(30, 100, 200, 0.1);
  border-color: rgba(30, 100, 200, 0.28);
}

.hb-rowlist {
  display: grid;
  gap: 0.55rem;
}

.hb-accordion {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

html[data-theme="light"] .hb-accordion {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(32, 27, 18, 0.1);
}

.hb-accordion.is-open {
  border-color: rgba(90, 168, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(90, 168, 255, 0.12);
}

.hb-accordion.is-hit {
  box-shadow: 0 0 0 2px rgba(90, 168, 255, 0.35);
}

.hb-rowlist__row {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr) 1.5rem;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.hb-accordion--markup .hb-rowlist__row {
  grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr) 1.5rem;
}

.hb-rowlist__row:hover {
  background: rgba(90, 168, 255, 0.1);
}

html[data-theme="light"] .hb-rowlist__row:hover {
  background: rgba(30, 100, 200, 0.07);
}

.hb-rowlist__img {
  width: 7.25rem;
  height: 7.25rem;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  padding: 0.35rem;
  box-sizing: border-box;
}

.hb-rowlist__img--wide {
  width: 100%;
  max-width: 14rem;
  height: 5rem;
  padding: 0.45rem 0.55rem;
}

.hb-rowlist__img.is-open {
  opacity: 0.92;
}

.hb-rowlist__text {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.hb-rowlist__num {
  font-weight: 800;
  font-size: 1.05rem;
}

.hb-rowlist__title {
  font-size: 0.95rem;
  line-height: 1.35;
  opacity: 0.92;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hb-accordion__chev {
  opacity: 0.55;
  font-size: 0.75rem;
  text-align: center;
}

.hb-accordion__panel {
  padding: 0 0.85rem 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .hb-accordion__panel {
  border-top-color: rgba(32, 27, 18, 0.08);
}

.hb-accordion__hero {
  display: block;
  width: min(16rem, 70%);
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: 0.85rem auto 0.75rem;
  padding: 0.55rem;
  border-radius: 14px;
  background: #fff;
  box-sizing: border-box;
}

.hb-accordion__hero--wide {
  width: min(100%, 28rem);
  aspect-ratio: 16 / 5;
  padding: 0.65rem 0.85rem;
}

.hb-accordion__desc {
  margin: 0;
  line-height: 1.55;
  font-size: 0.98rem;
}

@media (max-width: 640px) {
  .hb-rowlist__row {
    grid-template-columns: 5.25rem minmax(0, 1fr) 1.25rem;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
  }

  .hb-accordion--markup .hb-rowlist__row {
    grid-template-columns: minmax(7.5rem, 1fr) minmax(0, 1.4fr) 1.25rem;
  }

  .hb-rowlist__img {
    width: 5.25rem;
    height: 5.25rem;
  }

  .hb-rowlist__img--wide {
    max-width: 100%;
    height: 3.6rem;
  }

  .hb-accordion__hero {
    width: min(14rem, 88%);
  }
}

.pravila-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 960px) {
  .pravila-layout {
    grid-template-columns: minmax(14rem, 17rem) minmax(0, 1fr);
    gap: 1.25rem;
  }
}

.pravila-toc {
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 5.5rem);
  overflow: auto;
  padding: 0.85rem 0.75rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 14, 26, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-theme="light"] .pravila-toc {
  background: rgba(255, 252, 246, 0.88);
  border-color: rgba(32, 27, 18, 0.1);
}

.pravila-toc__title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.72;
}

.pravila-search {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  font: inherit;
}

html[data-theme="light"] .pravila-search {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(32, 27, 18, 0.12);
}

.pravila-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.pravila-toc__btn {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.3;
  cursor: pointer;
}

.pravila-toc__btn:hover,
.pravila-toc__btn.is-active {
  background: rgba(90, 168, 255, 0.16);
}

html[data-theme="light"] .pravila-toc__btn:hover,
html[data-theme="light"] .pravila-toc__btn.is-active {
  background: rgba(30, 100, 200, 0.1);
}

.pravila-toc__btn.is-hidden {
  display: none;
}

.pravila-mobile-select {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

@media (min-width: 960px) {
  .pravila-mobile-select {
    display: none;
  }
}

@media (max-width: 959px) {
  .pravila-toc {
    position: static;
    max-height: none;
  }

  .pravila-toc__list {
    display: none;
  }
}

.pravila-body {
  min-width: 0;
  padding: 1rem 1.05rem 1.25rem;
}

.pravila-body__meta {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  opacity: 0.78;
  line-height: 1.4;
}

.pravila-body__sources {
  margin: -0.35rem 0 1rem;
  font-size: 0.84rem;
  line-height: 1.45;
  opacity: 0.86;
}

.pravila-body__sources a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.pravila-body__title {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  line-height: 1.25;
}

.pravila-para {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  scroll-margin-top: 5.5rem;
  transition: background-color 1.2s ease, box-shadow 1.2s ease;
}

.pravila-para--table {
  white-space: normal;
  padding: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pravila-para--table::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.pravila-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  line-height: 1.4;
}

.pravila-table th,
.pravila-table td {
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.pravila-table th {
  font-weight: 750;
  background: rgba(90, 168, 255, 0.14);
}

.pravila-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .pravila-table th,
html[data-theme="light"] .pravila-table td {
  border-color: rgba(32, 27, 18, 0.12);
}

html[data-theme="light"] .pravila-table th {
  background: rgba(30, 100, 200, 0.1);
}

html[data-theme="light"] .pravila-table tbody tr:nth-child(even) td {
  background: rgba(32, 27, 18, 0.035);
}

.pravila-para.is-hit {
  background: rgba(90, 168, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(90, 168, 255, 0.35);
}

html[data-theme="light"] .pravila-para.is-hit {
  background: rgba(30, 100, 200, 0.1);
  box-shadow: inset 0 0 0 1px rgba(30, 100, 200, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  .pravila-para {
    transition: none;
  }
}

.pravila-status {
  margin: 0.5rem 0 0;
  opacity: 0.8;
}

.pravila-status.is-error {
  color: #ff8f8f;
}

.pravila-body a.hb-xref {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  text-decoration-color: rgba(90, 168, 255, 0.65);
  font-weight: 650;
}

.pravila-body a.hb-xref:hover {
  color: #8fd0ff;
  text-decoration-color: rgba(143, 208, 255, 0.95);
}

html[data-theme="light"] .pravila-body a.hb-xref {
  text-decoration-color: rgba(30, 100, 200, 0.45);
}

html[data-theme="light"] .pravila-body a.hb-xref:hover {
  color: #1565c0;
}

/* Мини-иконка знака/разметки сразу после номера (parity Unity inline thumbs) */
.hb-xref-icon {
  display: inline-block;
  width: 1.45em;
  height: 1.45em;
  object-fit: contain;
  vertical-align: -0.28em;
  margin-left: 0.18em;
  margin-right: 0.06em;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.hb-xref-icon--markup {
  width: 2.35em;
  height: 0.95em;
  vertical-align: -0.12em;
  padding: 0.08em 0.12em;
  box-sizing: content-box;
}

a.hb-xref .hb-xref-icon {
  /* иконка внутри ссылки — без отдельного underline на img */
  text-decoration: none;
}
