/* Impact Hub domain parking page.
   Animation and look come from the Hub Innovation home page banner (2021). */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/poppins-400.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/poppins-600.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/poppins-800.woff2") format("woff2");
}

:root {
  /* Must match SLIDE_MS in main.js */
  --slide-duration: 8s;
  --ease-draw: cubic-bezier(0.4, 0.6, 0.3, 1);
  --text-soft: rgb(255 255 255 / 0.82);
  --line-soft: rgb(255 255 255 / 0.4);
  --card-bg: rgb(22 20 44 / 0.38);
  --card-bg-hover: rgb(22 20 44 / 0.55);

  color-scheme: dark;
  background: #2b2d4c;
  /* Scale the whole composition up on big screens (16 px up to ~1780 px wide, max 24 px) */
  font-size: clamp(16px, 0.9vw, 24px);
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100svh;
  color: #fff;
  font-family: "Poppins", system-ui, sans-serif;
  line-height: 1.5;
  background: #2b2d4c url("img/background.jpg") center top / cover no-repeat;
}

:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Layout */

.page {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100svh;
  padding: clamp(16px, 2.5vw, 40px);
}

.logo {
  display: inline-block;
  border-radius: 2px;
}

.logo img {
  display: block;
  width: auto;
  height: clamp(3rem, 8vh, 5rem);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "eyebrow"
    "phrases"
    "art"
    "teaser"
    "controls";
  gap: clamp(14px, 2.5vh, 32px) clamp(24px, 5vw, 80px);
  align-content: center;
  width: min(100%, 73rem);
  margin: 0 auto;
  padding: clamp(12px, 4vh, 56px) 0;
}

@media (min-width: 900px) and (min-aspect-ratio: 1 / 1) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "eyebrow art"
      "phrases art"
      "teaser art"
      "controls art";
  }
}

.eyebrow {
  grid-area: eyebrow;
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  font-weight: 400;
}

.eyebrow strong {
  color: #fff;
  font-weight: 600;
}

/* Typed phrase ("Tvoříme …") */

.phrases {
  grid-area: phrases;
  container-type: inline-size;
}

.phrase {
  /* Longest line ("k udržitelnosti") has to fit the column */
  font-size: clamp(1.5rem, 9.6cqi, 4.4rem);
  /* Room for the stable word + three lines, so the layout doesn't jump between slides */
  min-height: 4.6em;
}

.phrase p {
  margin: 0;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.phrase-stable {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.phrase-written {
  display: block;
  padding-top: 0.2em;
  white-space: nowrap;
  animation: typing var(--slide-duration) both;
}

/* Negative top/bottom insets keep Czech diacritics (Ř, Í, Ů) from being clipped */
@keyframes typing {
  from {
    clip-path: inset(-0.4em 100% -0.4em -0.2em);
  }
  40%,
  70% {
    clip-path: inset(-0.4em 0 -0.4em -0.2em);
  }
  95%,
  to {
    clip-path: inset(-0.4em 100% -0.4em -0.2em);
  }
}

/* Line-art illustrations */

.art {
  grid-area: art;
  align-self: center;
  /* Single column: keep the drawing short (4:3) so the card stays on the first screen */
  width: min(100%, 30rem, 37svh);
  margin: 0 auto;
}

@media (min-width: 900px) and (min-aspect-ratio: 1 / 1) {
  .art {
    width: 100%;
  }
}

.art svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70svh;
  overflow: visible;
}

.line {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Longest stroke is ~880 units, so 1000 hides every one of them */
  stroke-dasharray: 1000;
}

/* A slide's strokes either draw and erase (show-hide), draw and stay for the
   next slide (show-only), or arrive drawn from the previous slide and erase
   (hide-only). That relay makes the nine drawings one continuous line. */
.show-hide {
  stroke-dashoffset: 1000;
  animation: show-hide var(--slide-duration) var(--ease-draw) both;
}

.show-only {
  stroke-dashoffset: 1000;
  animation: show-only var(--slide-duration) var(--ease-draw) both;
}

.hide-only {
  stroke-dashoffset: 0;
  animation: hide-only var(--slide-duration) var(--ease-draw) both;
}

/* 1 % = 80 ms; 5 % and 95 % leave a calm margin around slide changes */
@keyframes show-hide {
  5% {
    stroke-dashoffset: 1000;
  }
  65% {
    stroke-dashoffset: 0;
  }
  95%,
  to {
    stroke-dashoffset: 1000;
  }
}

@keyframes show-only {
  5% {
    stroke-dashoffset: 1000;
  }
  65%,
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes hide-only {
  0%,
  65% {
    stroke-dashoffset: 0;
  }
  95%,
  to {
    stroke-dashoffset: 1000;
  }
}

/* Static mode: paused, reduced motion, or no JS. Shows the slide's peak frame
   (65 %), where every stroke, including those handed over, is drawn. */

.is-static .line {
  animation: none;
  stroke-dashoffset: 0;
}

.is-static .phrase-written {
  animation: none;
  clip-path: none;
}

/* Card: what you find on impacthub.cz */

/* The whole card is the current point's link: hover and focus apply to the card */
.teaser {
  position: relative;
  grid-area: teaser;
  max-width: 36rem;
  padding: 0.85rem 0.6rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, background-color 0.2s;
}

.teaser:hover {
  border-color: #fff;
  background: var(--card-bg-hover);
}

.teaser:has(.point:focus-visible) {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.teaser-heading {
  margin: 0 0 0.35rem;
  padding: 0 0.6rem;
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* All points share one grid cell, so the card keeps the height of the longest one
   and doesn't jump. Only the current point is visible: the old one fades out,
   then the new one fades in and its underline is drawn like the strokes. */
.points {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.points > li {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s, visibility 0s 0.3s;
}

.points > li.is-current {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s 0.3s, visibility 0s 0.3s;
}

.point {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title arrow"
    "text arrow";
  align-items: center;
  gap: 0.2rem 1rem;
  height: 100%;
  padding: 0.5rem 0.6rem 0.6rem;
  color: inherit;
  text-decoration: none;
}

/* Stretch the link over the card (hidden points are visibility: hidden, so only the current one catches clicks) */
.point::after {
  content: "";
  position: absolute;
  inset: 0;
}

.point:focus-visible {
  outline: none;
}

.point-title {
  grid-area: title;
  justify-self: start;
  padding-bottom: 2px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  background: linear-gradient(#fff, #fff) left bottom / 0 1.5px no-repeat;
  transition: background-size 0.8s var(--ease-draw);
}

.is-current .point-title {
  background-size: 100% 1.5px;
  transition-delay: 0.4s;
}

.point-text {
  grid-area: text;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.point-arrow {
  grid-area: arrow;
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.2s;
}

.teaser:hover .point-arrow {
  transform: translateX(4px);
}

/* Slide controls */

.controls {
  grid-area: controls;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "toggle dots"
    "progress progress";
  align-items: center;
  gap: 0.6rem 1rem;
  max-width: 36rem;
}

.play-toggle {
  grid-area: toggle;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.25rem;
  padding: 0.3rem 0.9rem 0.3rem 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s;
}

.play-toggle:hover {
  border-color: #fff;
}

.icon {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
}

.play-toggle[data-state="playing"] .icon-play,
.play-toggle[data-state="paused"] .icon-pause {
  display: none;
}

.dots {
  grid-area: dots;
  display: flex;
  flex-wrap: wrap;
}

.dot {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.dot::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border: 1.5px solid #fff;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.dot:hover::before {
  background: rgb(255 255 255 / 0.5);
}

.dot[aria-current="true"]::before {
  background: #fff;
}

.progress {
  grid-area: progress;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.2);
}

.progress span {
  display: block;
  height: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
}

.is-static .progress {
  visibility: hidden;
}

.is-static .points > li,
.is-static .point-title {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .teaser,
  .points > li,
  .point-title,
  .point-arrow,
  .play-toggle,
  .dot::before {
    transition: none;
  }

  .teaser:hover .point-arrow {
    transform: none;
  }
}
