/* Книга-экскурсия: проводник, подписи к схемам, мостики, маршрут и словарик. Токены — из ../kniga-ideal/ideal.css */

/* ---------- Реплика проводника ---------- */
.g-say {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  max-width: 820px;
  margin: 4px 0 26px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 10px 26px rgb(0 0 0 / .14);
}
.g-ava {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gold);
  background: radial-gradient(circle at 35% 30%, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
}
.g-name { display: block; margin-bottom: 3px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.g-say p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-soft); }
.g-say p b { color: var(--text); font-weight: 700; }
.g-say-big { max-width: 880px; padding: 18px 22px; }
.g-say-big p { font-size: 17px; }

/* ---------- Как читать схему ---------- */
.howto { margin: -6px 0 26px; }
.howto-h { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.howto-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.howto-list li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
.howto-list li > b {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink); font-size: 13px; font-weight: 800;
}
.howto-list strong { display: block; font-size: 15px; line-height: 1.3; margin-bottom: 3px; color: var(--text); }
.howto-list span { display: block; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

/* ---------- Мостик между остановками ---------- */
.bridge {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center;
  margin-top: 34px; padding: 18px 22px; border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  box-shadow: inset 4px 0 0 var(--gold);
}
.bridge p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text-soft); max-width: 70ch; }
.bridge p b { color: var(--text); }
.bridge-btn { white-space: nowrap; }

/* ---------- Остановка 1 ---------- */
.tour-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.tour-step { padding: 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.ts-num { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.tour-step h3 { margin: 8px 0 6px; font-size: 24px; line-height: 1.15; }
.tour-step p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.ts-viz { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: 15px; color: var(--gold-2); }
.ts-viz b { font-weight: 700; color: var(--text); }
.ts-viz i { font-style: normal; color: var(--gold); padding: 0 2px; }
.ts-viz .ts-core { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); }
.ts-sky span { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text); font-size: 13.5px; }
.ts-arch { font-family: var(--font-serif, "Cormorant Garamond", serif); font-size: 20px; font-style: italic; }

.route-h { margin: 0 0 12px; font-size: 22px; }
.route-grid { list-style: none; margin: 0 0 30px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; counter-reset: none; }
.route-grid a {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; height: 100%;
  padding: 12px; border-radius: 12px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .2s, transform .2s;
}
.route-grid a:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.route-grid a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.route-grid b {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border-strong); font-size: 13px; color: var(--gold-2);
}
.route-grid .is-here b { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.route-grid strong { display: block; font-size: 14.5px; line-height: 1.3; }
.route-grid small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.route-grid em { display: block; margin-top: 6px; font-style: normal; font-size: 12px; color: var(--gold); }

.tour-gloss { padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.tour-gloss p { margin: 0 0 12px; font-size: 15px; color: var(--text-soft); }
.gl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gl-chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--border-strong); background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600;
}
.gl-chip:hover, .gl-chip[aria-expanded="true"] { background: var(--gold-soft); border-style: solid; }
.gl-chip-all { border-style: solid; color: var(--gold-2); }

/* ---------- Словарик: термин в тексте ---------- */
.gl-term {
  cursor: help;
  color: inherit;
  text-decoration: underline dashed var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 3px;
}
.gl-term:hover { background: var(--gold-soft); }
/* термин внутри блочных подписей остаётся в строке */
main span.gl-term, .howto-list span.gl-term { display: inline; font: inherit; color: inherit; margin: 0; }
.gl-term:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.gl-pop {
  position: absolute; z-index: 90; width: min(340px, calc(100vw - 32px));
  padding: 14px 16px 12px; border-radius: 14px;
  background: var(--surface-2, var(--surface)); color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 34px rgb(0 0 0 / .35);
  font-size: 14.5px; line-height: 1.55;
}
.gl-pop[hidden] { display: none; }
.gl-pop b { display: block; margin-bottom: 4px; font-size: 15px; color: var(--gold-2); }
.gl-pop p { margin: 0 0 8px; color: var(--text-soft); }
.gl-pop .gl-more { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; font-size: 13.5px; cursor: pointer; text-decoration: underline; }
.gl-pop .gl-x { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }

/* ---------- Стрелка наверх и панель «Словарик» ---------- */
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); color: var(--gold); border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgb(0 0 0 / .28);
  transition: opacity .25s, transform .25s, border-color .2s;
}
.to-top:hover { border-color: var(--gold); transform: translateY(-2px); }
.to-top:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.to-top.is-off { opacity: 0; pointer-events: none; transform: translateY(8px); }
.gl-drawer { position: fixed; inset: 0; z-index: 95; display: grid; justify-items: end; background: rgb(5 8 16 / .55); }
.gl-drawer[hidden] { display: none; }
.gl-panel {
  width: min(440px, 100vw); height: 100%; overflow: auto;
  padding: 22px 22px 40px; background: var(--bg, #0A0E1B); border-left: 1px solid var(--border-strong);
}
.gl-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.gl-panel-head h3 { margin: 0; font-size: 28px; }
.gl-panel-head button { width: 44px; height: 44px; border: 0; background: none; color: var(--text); font-size: 26px; cursor: pointer; }
.gl-panel > p { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.gl-list { margin: 0; }
.gl-list dt { margin-top: 14px; font-weight: 700; color: var(--gold-2); }
.gl-list dd { margin: 4px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--text-soft); }
.gl-list dt.is-flash { animation: glFlash 1.4s ease; }
@keyframes glFlash { from { background: var(--gold-soft); } to { background: transparent; } }

/* ---------- Картинки в шагах остановки 1 ---------- */
.ts-art { height: 108px; margin: -4px 0 12px; display: flex; align-items: center; color: var(--gold); }
.ts-art img { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 6px 18px rgb(0 0 0 / .35); border: 1px solid var(--border-strong); }
.ts-fan { position: relative; }
.ts-fan span { position: absolute; left: calc(var(--i) * 46px); top: 0; width: 70px; transform: rotate(calc((var(--i) - 1) * 7deg)); transform-origin: bottom center; }
.ts-fan span:nth-child(3) { z-index: 2; }
.ts-duo { gap: 10px; }
.ts-duo span { width: 70px; }
.ts-duo i { font-style: normal; font-size: 22px; color: var(--gold); }

/* ---------- Как из даты получаются числа ---------- */
.dformula { margin: 0 0 26px; padding: 18px 20px 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.df-rule { margin: 0 0 14px; font-size: 15px; color: var(--text-soft); max-width: 70ch; }
.df-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.df-card, .cs-card {
  width: 100%; display: grid; justify-items: center; gap: 6px; padding: 12px 10px; border-radius: 14px; cursor: pointer;
  background: var(--bg-2, var(--surface)); color: var(--text); border: 1px solid var(--border); font: inherit; text-align: center;
  transition: transform .2s, border-color .2s;
}
.df-card:hover, .cs-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.df-card:focus-visible, .cs-card:focus-visible, .cr-img:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.df-card img, .cs-card img { width: 100%; max-width: 120px; height: auto; border-radius: 8px; }
.df-card.is-core { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.df-calc { display: grid; gap: 2px; min-height: 44px; font-size: 13.5px; line-height: 1.35; color: var(--gold-2); font-weight: 700; }
.df-calc em { font-style: normal; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.df-card b, .cs-card b { font-size: 13.5px; line-height: 1.25; overflow-wrap: normal; }
.c-num { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; margin-top: 2px; border-radius: 999px; background: var(--gold-soft); border: 1px solid var(--border-strong); color: var(--gold-2); font-size: 12px; font-weight: 800; line-height: 1; }
.df-card small, .cs-card small { font-size: 12.5px; color: var(--muted); line-height: 1.3; }

/* ---------- Как читать карту аркана ---------- */
.cardread { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 26px; align-items: center; margin: 0 0 26px; padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.cr-img { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 14px; }
.cr-img img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border-strong); box-shadow: 0 14px 34px rgb(0 0 0 / .4); }
.cardread h3 { margin: 4px 0 10px; font-size: 28px; }
.cr-list { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 8px; }
.cr-list li { font-size: 15.5px; line-height: 1.55; color: var(--text-soft); }
.cr-list b { color: var(--text); }
.cr-note { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- Ленты карт в остановках ---------- */
.cstrip { margin: 0 0 28px; }
.cstrip-row { display: flex; align-items: stretch; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.cstrip-row::-webkit-scrollbar, .df-row::-webkit-scrollbar { display: none; }
.cs-card { flex: 0 0 152px; scroll-snap-align: start; align-content: start; }
.cs-sep { flex: 0 0 auto; align-self: center; font-size: 22px; color: var(--gold); font-weight: 700; }
.cstrip-note { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
/* лента из 4+ карт — на всю ширину, карты одинаковые и распределены по строке */
.cstrip-wide .cstrip-row { justify-content: center; gap: 14px; }
.cstrip-wide .cs-card { flex: 0 1 190px; min-width: 118px; }
.cstrip-wide .cs-card img { max-width: 150px; }
@media (max-width: 760px) {
  .cstrip-wide .cstrip-row { justify-content: flex-start; }
  .cstrip-wide .cs-card { flex: 0 0 132px; }
}
/* лента карт рядом с текстом на широком экране */
.cs-duo { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; margin: 0 0 28px; }
.cs-duo .cstrip, .cs-duo .g-say, .cs-duo .sphere-verdict { margin: 0; }
.cs-duo-say { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
/* рядом с текстом — компактные карты, чтобы высота совпадала с репликой */
.cs-duo .cs-card { flex-basis: 134px; padding: 10px 8px; }
.cs-duo .cs-card img { max-width: 86px; }
.cs-duo .cstrip-row { padding-bottom: 6px; }
.cs-duo-say .g-say { max-width: none; }
@media (max-width: 1100px) {
  .cs-duo, .cs-duo-say { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 1100px) {
  .df-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .howto-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .df-row { grid-template-columns: repeat(5, 140px); overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; scroll-snap-type: x proximity; }
  .df-row li { scroll-snap-align: start; }
  .dformula { padding: 16px 14px; }
  .df-card, .cs-card { padding: 10px 8px; }
  .cardread { grid-template-columns: 110px minmax(0, 1fr); gap: 14px; padding: 14px; align-items: start; }
  .cardread h3 { font-size: 22px; }
  .cr-list li { font-size: 14.5px; }
  .cs-card, .cstrip-wide .cs-card, .cs-duo .cs-card { flex: 0 0 140px; }
  .ts-art { height: 96px; }
  .g-say { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 12px 14px; margin-bottom: 20px; }
  .g-ava { width: 36px; height: 36px; }
  .g-ava svg { width: 20px; height: 20px; }
  .g-say p, .g-say-big p { font-size: 15.5px; }
  .howto-list { grid-template-columns: 1fr; gap: 8px; }
  .tour-steps { grid-template-columns: 1fr; gap: 10px; }
  .tour-step { padding: 16px; }
  .tour-step h3 { font-size: 22px; }
  .route-grid { grid-template-columns: 1fr; gap: 8px; }
  .bridge { grid-template-columns: 1fr; padding: 16px; }
  .bridge-btn { width: 100%; justify-content: center; white-space: normal; }
  .to-top { right: 12px; bottom: 12px; }
  .gl-pop { position: fixed; left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .route-grid a { transition: none; }
  .gl-list dt.is-flash { animation: none; }
}
@media print {
  .g-say, .bridge, .to-top, .gl-pop, .gl-drawer { display: none !important; }
  .gl-term { text-decoration: none; }
}
