/* ============================================================
   Lunate Wiki — стили поверх styles.css
   Длинные статьи: оглавление, карточки предметов, крафты,
   таблицы, галереи, лайтбокс
   ============================================================ */

/* ---------- Самодельный видеоплеер ---------- */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}
.video-player {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.video-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Watermark */
.vp-watermark {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  opacity: 0.75;
  transition: opacity 0.3s;
}
.vp-watermark img { width: 18px; height: 18px; border-radius: 4px; }
.vp-watermark span {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.06em;
}

/* Overlay (большая кнопка play в центре) */
.vp-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 0.25s;
}
.vp-overlay.hidden { opacity: 0; }
.vp-big-play {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: rgba(166, 200, 224, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.vp-big-play:hover {
  background: rgba(166, 200, 224, 0.22);
  transform: scale(1.08);
}
.vp-big-play svg { display: block; margin-left: 4px; }

/* Нижняя панель управления */
.vp-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: 28px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.vp-controls.show { opacity: 1; pointer-events: auto; }
.video-player.paused .vp-controls { opacity: 1; pointer-events: auto; }

.vp-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.vp-btn:hover { background: rgba(255, 255, 255, 0.12); }
.vp-btn svg { display: block; }

/* Прогресс-бар */
.vp-progress {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  height: 20px;
}
.vp-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  transition: height 0.15s;
  touch-action: none;
}
.vp-progress:hover .vp-track,
.video-player.dragging .vp-track { height: 6px; }
.vp-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--lun-bright, #8ab4d6);
  pointer-events: none;
}
.vp-thumb {
  position: absolute;
  left: 100%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lun-bright, #8ab4d6);
  box-shadow: 0 0 10px rgba(166, 200, 224, 0.5);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.vp-progress:hover .vp-thumb,
.video-player.dragging .vp-thumb {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Время */
.vp-time {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 100px;
  text-align: center;
}

/* Регулятор громкости */
.vp-vol-slider {
  flex: 0 0 auto;
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: width 0.2s;
}
.vp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}
.vp-vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}
.vp-vol-slider:focus {
  outline: 2px solid rgba(166, 200, 224, 0.5);
  outline-offset: 2px;
}

/* ---------- Шапка страницы ---------- */
.page-head {
  padding: 150px 0 26px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 13.5px;
  color: var(--fg-faint);
}
.breadcrumbs a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 180ms var(--ease-out);
}
.breadcrumbs a:hover { color: var(--fg); }
.breadcrumbs .crumb-sep { opacity: 0.5; }

.page-title {
  font-size: clamp(38px, 5.6vw, 64px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.page-title em {
  font-family: var(--font-brand);
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(120deg, #ffffff 20%, var(--lun) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-lead {
  max-width: 640px;
  margin-top: 18px;
  font-size: 17px;
  color: var(--fg-dim);
}

.page-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* обложка статьи */
.article-cover {
  margin: 34px 0 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.article-cover img {
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 8;
  object-fit: cover;
  filter: saturate(0.92);
}

/* ---------- Разметка статьи: оглавление + контент ---------- */
.article-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  padding-bottom: 90px;
}

.toc {
  position: sticky;
  top: 96px;
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.toc-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(166, 200, 224, 0.7);
  margin-bottom: 12px;
}
.toc ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc a {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 160ms var(--ease-out), background 160ms var(--ease-out);
}
.toc a:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
.toc a.active { color: var(--fg); background: rgba(166, 200, 224, 0.13); }
.toc .toc-num {
  flex: 0 0 26px;
  font-family: var(--font-brand);
  color: rgba(166, 200, 224, 0.65);
}
.toc .toc-sub a {
  padding-left: 46px;
  font-size: 12.5px;
}

/* ---------- Главы статьи ---------- */
.wchapter {
  padding: 26px 0 34px;
  scroll-margin-top: 96px;
}
.wchapter + .wchapter { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.wchap-head { max-width: 640px; margin-bottom: 30px; }
.wchap-head .section-title { font-size: clamp(27px, 3.4vw, 38px); }
.wchap-head .section-lead { margin-top: 12px; font-size: 15.5px; }

.wsub {
  scroll-margin-top: 96px;
  margin: 40px 0 18px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.wsub em {
  font-family: var(--font-brand);
  font-style: italic;
  font-weight: 500;
  color: var(--lun-bright);
}

.wchapter > p, .wtext {
  max-width: 720px;
  font-size: 15.5px;
  color: var(--fg-dim);
  margin-bottom: 14px;
}
.wtext b, .wchapter > p b { color: var(--fg); font-weight: 650; }

/* ---------- Карточки предметов ---------- */
.item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.item-grid .item-wide { grid-column: 1 / -1; }

.item {
  padding: 24px 24px 22px;
  border-radius: var(--radius-lg);
  scroll-margin-top: 96px;
}

.item-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 13px;
}
.item-ico {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: linear-gradient(160deg, rgba(166, 200, 224, 0.13), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(166, 200, 224, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.item-ico img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
}
.item-head h4 {
  font-size: 17.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.item-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
}
.item > p {
  font-size: 14.5px;
  color: var(--fg-dim);
}
.item > p + p { margin-top: 8px; }
.item p b { color: var(--fg); font-weight: 650; }

/* ---------- Скриншоты и крафты ---------- */
.shot { margin-top: 14px; min-width: 0; }
.shot img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  cursor: zoom-in;
  transition: border-color 200ms var(--ease-out), transform 250ms var(--ease-out);
}
.shot img:hover { border-color: rgba(166, 200, 224, 0.4); }
.shot figcaption {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--fg-faint);
}

.shot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}
.shot-row .shot { flex: 1 1 240px; max-width: 420px; margin-top: 0; }

/* горизонтальная галерея */
.gallery {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}
.gallery .shot {
  flex: 0 0 auto;
  width: min(300px, 78vw);
  margin-top: 0;
}
.gallery .shot img { width: 100%; }

/* ---------- Режимы инструментов ---------- */
.modes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.modes li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 13.5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.modes b { color: var(--fg); font-weight: 600; white-space: nowrap; }
.modes span { color: var(--fg-dim); text-align: right; }

/* ---------- Выноски ---------- */
.callout {
  display: flex;
  gap: 14px;
  max-width: 720px;
  margin: 18px 0;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(166, 200, 224, 0.07);
  border: 1px solid rgba(166, 200, 224, 0.22);
  font-size: 14.5px;
  color: var(--fg-dim);
}
.callout b { color: var(--fg); }
.callout-ico { flex: 0 0 auto; color: var(--lun-bright); margin-top: 2px; }
.callout.warn {
  background: rgba(224, 178, 128, 0.07);
  border-color: rgba(224, 178, 128, 0.3);
}
.callout.warn .callout-ico { color: #e8c9a0; }

/* ---------- Таблица уровней ---------- */
.table-scroll {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.tier-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}
.tier-table th, .tier-table td {
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}
.tier-table th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(166, 200, 224, 0.75);
}
.tier-table tr:last-child td { border-bottom: none; }
.tier-table td:first-child {
  font-family: var(--font-brand);
  color: var(--lun-bright);
}
.tier-table td { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.tier-table td:last-child { color: var(--fg); font-weight: 600; }

/* ---------- Шаги (реактор и т.п.) ---------- */
.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 18px 0;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 16px 20px 16px 58px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14.5px;
  color: var(--fg-dim);
}
.steps > li b { color: var(--fg); }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 15px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #0a0c10;
  background: linear-gradient(165deg, #ffffff, var(--lun-bright));
  box-shadow: 0 4px 14px rgba(166, 200, 224, 0.25);
}
.steps .shot { max-width: 460px; }

/* ---------- Хаб вики ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 100px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 320ms var(--ease-out), border-color 320ms, box-shadow 320ms var(--ease-out);
}
.guide-card:hover {
  transform: translateY(-5px);
  border-color: rgba(166, 200, 224, 0.3);
  box-shadow: var(--glass-highlight), 0 30px 70px rgba(0, 0, 0, 0.6);
}

.guide-cover {
  position: relative;
  aspect-ratio: 16 / 7;
  overflow: hidden;
}
.guide-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: transform 600ms var(--ease-out);
}
.guide-card:hover .guide-cover img { transform: scale(1.045); }
.guide-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(8, 9, 12, 0.75));
}

.guide-body { padding: 22px 26px 26px; }
.guide-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(166, 200, 224, 0.75);
  margin-bottom: 8px;
}
.guide-body h3 {
  font-family: var(--font-brand);
  font-size: 25px;
  font-weight: 600;
  margin-bottom: 8px;
}
.guide-body > p { font-size: 14.5px; color: var(--fg-dim); }
.guide-meta {
  display: block;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--fg-faint);
}

.guide-card.soon {
  justify-content: center;
  align-items: center;
  min-height: 220px;
  text-align: center;
  border-style: dashed;
  opacity: 0.6;
  cursor: default;
}
.guide-card.soon:hover { transform: none; box-shadow: var(--glass-highlight), var(--glass-shadow); }
.guide-card.soon .guide-body h3 { margin-bottom: 4px; }

/* ---------- Лайтбокс ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 5, 10, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms var(--ease-out), visibility 0s linear 260ms;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 260ms var(--ease-out), visibility 0s;
}
.lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(1100px, 94vw);
}
.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.8);
  transform: scale(0.97);
  transition: transform 300ms var(--ease-spring);
}
.lightbox.open img { transform: scale(1); }
.lightbox figcaption { font-size: 13.5px; color: var(--fg-dim); text-align: center; }
.lb-close {
  position: absolute;
  top: 20px;
  right: 22px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--fg);
  font-size: 17px;
  cursor: pointer;
  transition: background 180ms var(--ease-out);
}
.lb-close:hover { background: rgba(255, 255, 255, 0.14); }

/* ---------- Кнопка «наверх» ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 80;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--fg);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out), visibility 0s linear 260ms;
}
.to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out), visibility 0s;
}
.to-top:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Подвал статьи ---------- */
.article-credits {
  margin-top: 30px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--fg-faint);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
}
.article-credits a { color: var(--fg-dim); }
.article-credits a:hover { color: var(--fg); }

/* ---------- Адаптив ---------- */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: 1fr; gap: 28px; }
  .toc {
    position: static;
    max-height: none;
    order: -1;
  }
  .toc ol { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .toc a { padding: 7px 12px; }
  .toc .toc-num { flex: 0 0 auto; }
  .toc .toc-sub a { padding-left: 12px; }
  .page-head { padding-top: 130px; }
}

@media (max-width: 720px) {
  .item-grid { grid-template-columns: 1fr; }
  .hub-grid { grid-template-columns: 1fr; }
  .modes li { flex-direction: column; gap: 3px; }
  .modes span { text-align: left; }
  .steps > li { padding-left: 54px; }
  .article-cover img { aspect-ratio: 16 / 9; }
  .to-top { right: 14px; bottom: 16px; }
}

@media (max-width: 560px) {
  .vp-vol-slider { display: none; }
  .vp-time { font-size: 11px; min-width: 80px; }
  .vp-big-play { width: 60px; height: 60px; }
  .vp-big-play svg { width: 38px; height: 38px; }
}
