/**
 * @file
 * Front page sections.
 */

.front-page__section--light {
  background: var(--imtm-color-surface-light);
}

.front-page__section--dark {
  background: var(--imtm-color-surface-alt);
}

.front-page__messages {
  padding-top: var(--imtm-space-3);
}

.front-page__news {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--imtm-gutter);
}

.front-page__news-aside {
  padding-bottom: var(--imtm-space-section);
}

@media (min-width: 992px) {
  .front-page__news {
    grid-template-columns: calc(66.6667% - var(--imtm-gutter) / 3) calc(33.3333% - var(--imtm-gutter) * 2 / 3);
  }
}

.front-page {
  display: flex;
  flex-direction: column;
  /* The admin toolbar pads the body; keep the footer at the viewport bottom. */
  min-height: calc(100vh - var(--drupal-displace-offset-top, 0px));
}

.front-page__main {
  flex: 1 0 auto;
  /* Elements sliding in from the side (reveal) must not widen the page. */
  overflow-x: clip;
  color: var(--imtm-color-text);
}

/* Social profiles card (aside of the news). */
.front-page__social {
  padding: 1.5rem;
  margin-top: 0.5rem;
  background: var(--imtm-color-white);
  border-top: 4px solid var(--imtm-color-blue);
  box-shadow: var(--imtm-shadow-soft);
}

.front-page__social-title {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--imtm-color-text);
}

.front-page__social-text {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.front-page__social-link {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.75rem 0;
  color: var(--imtm-color-text);
  text-decoration: none;
  border-top: 1px solid var(--imtm-color-border);
}

.front-page__social-link:hover,
.front-page__social-link:focus-visible {
  color: var(--imtm-color-darkred);
  text-decoration: none;
}

.front-page__social-icon.fa {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.15rem;
  color: var(--imtm-color-white);
  background: var(--imtm-color-text);
  border-radius: 50%;
  transition: background-color var(--imtm-transition);
}

.front-page__social-link:hover .front-page__social-icon {
  background: var(--imtm-color-darkred);
}

.front-page__social-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-weight: 700;
  line-height: 1.3;
}

.front-page__social-handle {
  overflow: hidden;
  font-weight: 400;
  color: var(--imtm-color-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.front-page__social-arrow {
  margin-left: auto;
  font-size: 1.25rem;
}

/* Scroll reveal (front-page.js). Variants are assigned per element type;
   items of one row follow each other (--reveal-delay). */
.front-page__reveal {
  --reveal-ease: cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transition:
    opacity 0.9s var(--reveal-ease),
    transform 1s var(--reveal-ease),
    filter 1s var(--reveal-ease),
    letter-spacing 1.1s var(--reveal-ease);
  transition-delay: var(--reveal-delay, 0s);
}

.front-page__reveal.front-page__reveal--visible {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Section titles: letters close in, then the accent line is drawn. */
.front-page__reveal--title {
  letter-spacing: 0.35em;
  transform: translateY(1rem);
  transition-property: opacity, transform, letter-spacing;
}

.front-page__reveal--title.front-page__reveal--visible {
  letter-spacing: normal;
}

/* Accent line under section titles; revealed titles draw it in. */
.front-page__main .section__title::after {
  display: block;
  width: 64px;
  height: 4px;
  margin: 0.75rem auto 0;
  content: "";
  background: var(--imtm-color-red);
  border-radius: 2px;
}

.front-page__reveal--title::after {
  width: 0;
  transition: width 0.9s var(--reveal-ease) 0.5s;
}

.front-page__reveal--title.front-page__reveal--visible::after {
  width: 64px;
}

/* News from the left, aside from the right. */
.front-page__reveal--left {
  transform: translateX(-3rem);
}

.front-page__reveal--right {
  transform: translateX(3rem);
}

/* Tiles come into focus. */
.front-page__reveal--focus {
  filter: blur(8px);
  transform: translateY(2.5rem) scale(0.92);
}

/* Service icons pop in. */
.front-page__reveal--pop {
  transform: scale(0.5) rotate(-12deg);
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.front-page__reveal--rise {
  transform: translateY(1.5rem);
}

/* Tiles lift on hover. */
.front-page__main .grid__item > * {
  transition: transform 0.35s var(--reveal-ease, ease), box-shadow 0.35s ease;
}

.front-page__main .grid__item:hover > * {
  transform: translateY(-6px);
}

@media (prefers-reduced-motion: reduce) {
  .front-page__main .grid__item:hover > * {
    transform: none;
  }
}

/* Reading progress line and carousel parallax – CSS scroll-driven
   animations where supported. */
.front-page__progress {
  display: none;
}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .front-page__progress {
      position: fixed;
      top: var(--drupal-displace-offset-top, 0);
      right: 0;
      left: 0;
      z-index: 600;
      display: block;
      height: 3px;
      background: linear-gradient(90deg, var(--imtm-color-red), var(--imtm-color-darkred));
      transform-origin: 0 50%;
      animation: front-page-progress linear both;
      animation-timeline: scroll(root);
    }

    .front-page__main .carousel-slide__image {
      animation: front-page-parallax linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}

@keyframes front-page-progress {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes front-page-parallax {
  to {
    transform: translateY(30%);
  }
}

/* Featured publication covers tilt towards the pointer (front-page.js). */
.front-page__main .publication__image {
  transition: transform 0.25s ease;
}
