:root {
  --bg-0: #0c1c15;
  --bg-1: #143528;
  --bg-2: #1a4534;
  --card: rgba(36, 88, 66, 0.58);
  --card-strong: rgba(44, 108, 80, 0.74);
  --ink: #f2faf5;
  --ink-soft: rgba(210, 232, 220, 0.82);
  --line: rgba(170, 220, 190, 0.22);
  --accent: #9fe3b8;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  --radius: 18px;
  --font-ui: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --pattern-a: url("assets/pattern-a.png");
  --pattern-b: url("assets/pattern-b.png");
  --pattern-c: url("assets/pattern-c.png");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  font-family: var(--font-ui);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(70, 150, 112, 0.38) 0%, transparent 55%),
    radial-gradient(70% 50% at 100% 80%, rgba(36, 96, 68, 0.45) 0%, transparent 50%),
    linear-gradient(180deg, #1a4534 0%, var(--bg-1) 45%, #0e241c 100%);
}

.page {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px 10px;
}

.header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: end;
  margin-bottom: 0;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.compass {
  position: relative;
  flex: 0 0 auto;
  width: clamp(88px, 22vw, 118px);
  height: clamp(100px, 25vw, 136px);
  border-radius: 0;
  color: var(--ink);
  display: grid;
  place-items: center;
  overflow: visible;
  pointer-events: none;
  user-select: none;
  align-self: center;
  box-shadow: none;
  background: transparent;
}

.compass-hex {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
}

.titles {
  min-width: 0;
  align-self: center;
  padding-right: 6px;
}

.name-en {
  margin: 0 0 2px;
  font-size: clamp(0.72rem, 2.2vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.name-ru {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.2rem, 4.6vw, 2.05rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
}

.name-ru span {
  display: block;
}

.portrait {
  margin: 0;
  align-self: end;
  width: clamp(78px, 18vw, 112px);
  max-height: 132px;
  line-height: 0;
  margin-left: 2px;
  margin-bottom: 0;
  overflow: visible;
  position: relative;
  z-index: 3;
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 132px;
  object-fit: contain;
  object-position: bottom center;
  user-select: none;
  pointer-events: none;
}

.rule {
  height: 1px;
  margin-top: 0;
  position: relative;
  z-index: 1;
  background: linear-gradient(90deg, transparent, var(--line) 10%, var(--line) 90%, transparent);
}

@media (max-width: 819px) {
  .page {
    gap: 2px 10px;
  }

  .header {
    column-gap: 8px;
    margin-bottom: -2px;
  }

  .titles {
    padding-right: 4px;
  }

  .portrait {
    width: clamp(84px, 26vw, 108px);
    max-height: none;
    margin-left: 0;
    margin-bottom: -6px;
    overflow: visible;
  }

  .portrait img {
    max-height: none;
    height: auto;
  }

  .name-ru {
    font-size: clamp(1.15rem, 4.4vw, 1.55rem);
  }

  .channels {
    margin-top: -2px;
  }
}

.channels {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 9px;
  padding-top: 4px;
  margin-top: 0;
}

.channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.channel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid rgba(159, 227, 184, 0.18);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Mobile / touch: taller hit targets */
@media (max-width: 819px) {
  .channel {
    min-height: 74px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .channel--navigator {
    min-height: 92px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .side-block {
    min-height: 74px;
  }

  .channel-row:has(.channel--navigator) .side-block {
    min-height: 92px;
  }

  .label {
    font-size: clamp(1.35rem, 5.4vw, 1.65rem);
  }

  .label-main {
    font-size: clamp(1.12rem, 4.4vw, 1.35rem);
  }

  .label-sub {
    font-size: clamp(0.92rem, 3.5vw, 1.08rem);
  }
}

.channel:hover,
.channel:focus-visible {
  transform: translateY(-1px);
  background: var(--card-strong);
  border-color: rgba(159, 227, 184, 0.4);
  outline: none;
}

.channel:active {
  transform: scale(0.985);
}

.edge-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.edge-pattern__side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  max-width: 130px;
  opacity: 0.48;
  background-image: var(--pattern-b);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.edge-pattern__side--left {
  left: 0;
  -webkit-mask-image: linear-gradient(
    90deg,
    #000 0%,
    rgba(0, 0, 0, 0.9) 28%,
    rgba(0, 0, 0, 0.45) 58%,
    rgba(0, 0, 0, 0.12) 78%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000 0%,
    rgba(0, 0, 0, 0.9) 28%,
    rgba(0, 0, 0, 0.45) 58%,
    rgba(0, 0, 0, 0.12) 78%,
    transparent 100%
  );
}

.edge-pattern__side--right {
  right: 0;
  transform: scaleX(-1);
  -webkit-mask-image: linear-gradient(
    90deg,
    #000 0%,
    rgba(0, 0, 0, 0.9) 28%,
    rgba(0, 0, 0, 0.45) 58%,
    rgba(0, 0, 0, 0.12) 78%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000 0%,
    rgba(0, 0, 0, 0.9) 28%,
    rgba(0, 0, 0, 0.45) 58%,
    rgba(0, 0, 0, 0.12) 78%,
    transparent 100%
  );
}

.icon,
.label {
  position: relative;
  z-index: 1;
}

.icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(12, 36, 26, 0.28);
  border: 1px solid rgba(159, 227, 184, 0.28);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.icon svg {
  display: block;
  flex-shrink: 0;
}

.icon-telegram svg {
  transform: translate(-1.5px, 0.5px);
}

.icon-rutube svg {
  transform: translate(0, 0);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.35));
}

.icon-vk svg {
  transform: translate(0, 0.5px) scale(1.12);
  transform-origin: center;
}

.channel--navigator {
  padding-left: 16px;
  padding-right: 16px;
  min-height: 86px;
  background: linear-gradient(135deg, rgba(92, 24, 28, 0.82) 0%, rgba(58, 14, 18, 0.88) 100%);
  border-color: rgba(210, 110, 100, 0.38);
  box-shadow: 0 8px 24px rgba(50, 8, 12, 0.35);
}

.channel--navigator:hover,
.channel--navigator:focus-visible {
  background: linear-gradient(135deg, rgba(110, 32, 36, 0.9) 0%, rgba(72, 18, 22, 0.92) 100%);
  border-color: rgba(230, 140, 125, 0.5);
}

.channel--navigator .label {
  position: relative;
  z-index: 2;
  padding: 0 12px;
}

.label--lessons {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  text-align: center;
}

.label-main {
  font-size: clamp(1.05rem, 3.8vw, 1.28rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.label-sub {
  font-size: clamp(0.88rem, 3.1vw, 1.05rem);
  font-weight: 700;
  opacity: 0.92;
}

.label--wrap {
  line-height: 1.15;
}

/* Floating Arabic letters on navigator — edges only, fade in/out */
.edge-pattern--letters {
  z-index: 0;
  /* Keep center clear for the label */
  -webkit-mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 22%,
    transparent 34%,
    transparent 66%,
    #000 78%,
    #000 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 22%,
    transparent 34%,
    transparent 66%,
    #000 78%,
    #000 100%
  );
}

.arab-letter {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: calc(1.05rem * var(--s, 1));
  font-weight: 700;
  line-height: 1;
  color: rgba(210, 240, 220, 0.55);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -50%);
  animation: arab-fade 5.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.channel--navigator .arab-letter {
  color: rgba(255, 205, 195, 0.58);
}

/* Longer visible window + staggered delays = always many letters on screen */
@keyframes arab-fade {
  0%,
  6% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  14%,
  48% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }
  58%,
  100% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(1.04);
  }
}

.label {
  margin: 0;
  width: 100%;
  padding: 0 58px;
  text-align: center;
  font-size: clamp(1.42rem, 5.8vw, 1.78rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.side-block {
  display: none;
  min-height: 64px;
  border-radius: var(--radius);
  background: rgba(28, 72, 54, 0.28);
  border: 1.5px dashed rgba(159, 227, 184, 0.22);
}

@media (min-width: 820px) {
  .page {
    max-width: 980px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .channel-row {
    grid-template-columns: minmax(320px, 1.1fr) minmax(200px, 0.9fr);
    gap: 0;
  }

  .channel-row .channel {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right-color: transparent;
    position: relative;
    z-index: 1;
  }

  .side-block {
    display: block;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -2px;
    padding-left: 2px;
    position: relative;
    z-index: 2;
    border-left: none;
  }

  .label {
    font-size: 1.85rem;
  }

  .name-ru {
    font-size: 2.15rem;
  }

  /* Desktop portrait only — mobile untouched */
  .titles {
    padding-right: 2px;
  }

  .portrait {
    width: 126px;
    max-height: 150px;
    margin-left: -4px;
    margin-bottom: -11px;
  }

  .portrait img {
    max-height: 150px;
  }
}

/* Short screens on desktop only — don't shrink mobile tap targets */
@media (max-height: 740px) and (min-width: 820px) {
  .page {
    gap: 8px;
  }

  .channels {
    gap: 8px;
  }

  .channel {
    min-height: 56px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .icon {
    width: 44px;
    height: 44px;
  }

  .label {
    padding: 0 52px;
    font-size: 1.45rem;
  }

  .compass {
    width: 88px;
    height: 88px;
  }

  .name-ru {
    font-size: clamp(1.25rem, 4.8vw, 1.6rem);
  }
}

@media (max-width: 819px) and (max-height: 740px) {
  .page {
    gap: 8px;
  }

  .channels {
    gap: 7px;
  }

  .channel {
    min-height: 64px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .compass {
    width: 84px;
    height: 84px;
  }

  .name-ru {
    font-size: clamp(1.15rem, 4.4vw, 1.45rem);
  }
}

.page-umrah {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  justify-items: center;
  gap: 20px;
}

.page-umrah .back {
  justify-self: start;
}

.back {
  width: fit-content;
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
}

.back:hover,
.back:focus-visible {
  color: var(--ink);
  outline: none;
}

.umrah-choices {
  align-self: center;
  justify-self: center;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 520px);
}

.channel--choice {
  min-height: 72px;
}

.channel--choice .label {
  padding: 0 16px;
}

@media (max-width: 819px) {
  .channel--choice {
    min-height: 80px;
  }
}

.umrah-card {
  margin: auto 0;
  padding: clamp(22px, 4vw, 36px);
  border-radius: 24px;
  background: var(--card);
  border: 1px solid rgba(159, 227, 184, 0.2);
  box-shadow: var(--shadow);
  max-width: 560px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.umrah-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.umrah-card h1 {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 4.5vw, 2.15rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.umrah-lead {
  margin: 0 0 22px;
  color: var(--ink-soft);
  line-height: 1.5;
  font-size: 1.08rem;
  font-weight: 600;
}

.umrah-cta {
  width: fit-content;
  max-width: 100%;
}

body.page-scroll {
  overflow: auto;
  min-height: 100%;
  height: auto;
}

html:has(body.page-scroll) {
  height: auto;
  overflow: auto;
}

.page-tours {
  height: auto;
  min-height: 100%;
  max-width: 720px;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 18px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.tours-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 6vw, 2.35rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tours-kicker {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.tours-lead {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: clamp(1rem, 3.6vw, 1.12rem);
  font-weight: 600;
}

.tours-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tours-status,
.tours-empty {
  margin: 0;
  padding: 22px 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(159, 227, 184, 0.18);
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.45;
  font-size: 1.05rem;
}

.tour-card {
  border-radius: 22px;
  background: var(--card);
  border: 1px solid rgba(159, 227, 184, 0.18);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.tour-card__body {
  padding: clamp(18px, 4vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-card__date {
  margin: 0;
  color: var(--accent);
  font-size: clamp(0.92rem, 3.2vw, 1.05rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tour-card__title {
  margin: 0;
  font-size: clamp(1.45rem, 5.4vw, 1.95rem);
  line-height: 1.2;
  font-weight: 800;
}

.tour-card__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  font-size: clamp(1.12rem, 4.2vw, 1.35rem);
  line-height: 1.55;
}

.tour-card__fold {
  position: relative;
  margin: 4px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tour-card__fold:not(.is-open) .tour-card__content {
  max-height: calc(1.55em * 7);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 48%,
    rgba(0, 0, 0, 0.55) 72%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 48%,
    rgba(0, 0, 0, 0.55) 72%,
    transparent 100%
  );
}

.tour-card__fold.is-open .tour-card__content {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.tour-card__expand {
  display: none;
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(159, 227, 184, 0.28);
  border-radius: 14px;
  background: rgba(12, 36, 26, 0.55);
  color: var(--accent);
  font: inherit;
  font-size: clamp(1rem, 3.6vw, 1.12rem);
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 2;
}

.tour-card__fold:not(.is-open) .tour-card__expand:not([hidden]) {
  display: block;
}

.tour-card__expand:hover,
.tour-card__expand:focus-visible {
  color: var(--ink);
  border-color: rgba(159, 227, 184, 0.45);
  outline: none;
}

.tour-card__block {
  margin: 0;
  color: var(--ink);
  font-size: inherit;
  line-height: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
}

.tour-card__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.tour-card__cta {
  min-height: 58px;
  width: 100%;
}

.tour-card__cta .label {
  font-size: clamp(1.05rem, 3.8vw, 1.2rem);
  font-weight: 800;
}

@media (min-width: 560px) {
  .tour-card__actions {
    flex-direction: row;
  }

  .tour-card__cta {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .channel {
    transition: none;
  }

  .compass-needle,
  .arab-letter {
    animation: none;
  }

  .arab-letter {
    opacity: 0.35;
  }
}
