/* ============================================================================
 * The home hero's city control — tools/gen_home.py — and the route block
 * ============================================================================
 *
 * A city is a page, not a state of this one: the control is two links, Tashkent
 * to the home page, Samarkand to /samarkand/. It looks and sits the same on both,
 * which is why /samarkand/ loads this sheet too (views/partials/city-home.php).
 * What the control asks of the customer's hero block is in assets/fixes.css.
 */

.hero-cities {
  display: flex;
  width: fit-content;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding: 0.375rem;
  border-radius: 10px;
  background-color: rgba(43, 49, 65, 0.8);
}

.hero-cities__tab {
  padding: 0.5rem 1.125rem;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 500;
  text-decoration: none;
  transition:
    background-color 0.35s ease,
    color 0.35s ease;
}

.hero-cities__tab:hover,
.hero-cities__tab:focus-visible {
  background-color: rgba(237, 26, 32, 0.25);
}

.hero-cities__tab[aria-current="page"] {
  background-color: #ed1a20;
}

/* /samarkand/: the control stands where it stands on the home page, so pressing it
   changes the picture and not the place. The home hero centres its content in
   100vh less 6.5rem + 4rem of padding, so the control's top there is 50vh + 20px
   less half the content, and the content is the title plus a fixed rest. The title
   is the only part that moves: its lines are in --home-title-lines, per language.
   /samarkand/ starts 5.5rem down, under the header, hence the 4.25rem below.
   The values mirror the customer's hero: if its title changes length, the numbers
   here go with it, and tools/behaviour_check.py (heroalign) says so. */
.city-hero--home {
  --home-title-lines: 1;
  --home-title-line: 1.95rem;
  --home-rest: 11.375rem;
}

.city-hero--home:lang(ru) {
  --home-title-lines: 2;
}

@media (max-width: 26.5rem) {
  .city-hero--home:lang(uz) {
    --home-title-lines: 2;
  }
}

@media (max-width: 21.5rem) {
  .city-hero--home:lang(en) {
    --home-title-lines: 2;
  }
}

@media not all and (max-width: 63.75rem) {
  .city-hero--home {
    --home-title-line: calc(1.2 * clamp(2.5rem, 4vw + 1rem, 4.25rem));
    --home-rest: 10.875rem;
  }
}

.city-hero--home.city-hero--image {
  align-items: stretch;
  padding-top: 0;
}

.city-hero--home.city-hero--image .container {
  display: flex;
  flex-direction: column;
}

.city-hero--home.city-hero--image .hero-cities {
  /* 1rem is what the home page keeps when its content outgrows the screen. */
  margin-top: max(
    1rem,
    calc(50vh - 4.25rem - (var(--home-rest) + var(--home-title-lines) * var(--home-title-line)) / 2)
  );
}

/* The crumbs, the title and the buttons stay at the foot of the picture. */
.city-hero--home.city-hero--image .breadcrumbs {
  margin-top: auto;
}

@media (max-width: 63.75rem) {
  .city-hero--home.city-hero--image .hero-cities {
    align-self: center;
  }
}

@media (max-width: 63.75rem) {
  /* The cities decide which ticket gets sold: a thumb's 44px. So do the stops. */
  .hero-cities__tab,
  .schedule-card__link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }
}

/* The route block's stop titles link to the stop pages. */
.schedule-card__link {
  color: inherit;
  text-decoration: none;
  transition: color 0.35s ease;
}

.schedule-card__link:hover,
.schedule-card__link:focus-visible {
  color: #ed1a20;
}

@media (prefers-reduced-motion: reduce) {
  .hero-cities__tab,
  .schedule-card__link {
    transition: none;
  }
}
