/* =========================================================================
   FOOTER
   Logo + menüü + usaldusmärk ülemises reas, kontaktitulbad (widgetid) gridis.
   Laetakse pärast main.css ja responsive.css, et vanad flex-reeglid üle
   kirjutada. Tulpade arv tuleb footer.php-st (--ft-count).
   ========================================================================= */

.page-footer {
  --ft-bg: #3b3b3b;
  --ft-bg-deep: #2a2a2a;
  --ft-ink: #fff;
  --ft-muted: rgba(255, 255, 255, 0.72);
  --ft-line: rgba(255, 255, 255, 0.16);
  --ft-accent: #e31e24;
  --ft-gutter: clamp(20px, 6vw, 117px);
  --ft-col-gap: clamp(24px, 2.6vw, 48px);
  --ft-text: clamp(14px, 0.25vw + 12px, 16px);
  --ft-title: clamp(15px, 0.35vw + 12.5px, 18px);
  --ft-label: clamp(12px, 0.15vw + 10.5px, 13px);
}

/* --- Konteiner + kivisoonte taust -------------------------------------- */

.page-footer .footer-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(40px, 4.5vw, 72px);
  min-height: 0;
  padding: clamp(48px, 7vw, 120px) var(--ft-gutter) clamp(48px, 6vw, 104px);
  background: linear-gradient(165deg, var(--ft-bg) 0%, var(--ft-bg) 40%, var(--ft-bg-deep) 100%);
  isolation: isolate;
}

/* Group.png = kivisoonte joonis. Hajub vasakule, et tekst jääks loetavaks. */
.page-footer .footer-container::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url(../img/Group.png) no-repeat right -60px top -20px / 1305px auto;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(to left, #000 20%, transparent 80%);
  mask-image: linear-gradient(to left, #000 20%, transparent 80%);
}

/* Peen kivigraan – lihvitud kivipinna tunne */
.page-footer .footer-container::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Vanad .footer-block reeglid (flex, keskele joondus, peitmine) maha */
.page-footer .footer-container .footer-block {
  display: block;
  flex: none;
  width: auto;
  margin: 0;
  text-align: left;
}

/* --- Ülemine rida: logo | menüü | usaldusmärk --------------------------- */

.page-footer .footer-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "logo menu stamp";
  align-items: center;
  gap: 24px clamp(32px, 4vw, 72px);
}

.page-footer .footer-top .footer-logo {
  grid-area: logo;
  display: block;
}

.page-footer .footer-top .footer-logo img {
  display: block;
  width: auto;
  max-width: clamp(110px, 9vw, 160px);
  height: auto;
}

.page-footer .footer-top .list-wrapper {
  grid-area: menu;
  justify-self: end;
}

.page-footer .footer-top .list-wrapper ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px clamp(20px, 2.2vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-footer .footer-top .list-wrapper li {
  margin: 0;
  line-height: 1.3;
}

.page-footer .footer-top .list-wrapper a,
.page-footer .footer-top .list-wrapper li {
  font-family: Raleway, sans-serif;
  font-size: var(--ft-label);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ft-ink);
}

.page-footer .footer-top .list-wrapper a {
  display: inline-block;
  padding: 6px 0;
  text-decoration: none;
  background: linear-gradient(var(--ft-accent), var(--ft-accent)) no-repeat left bottom / 0 2px;
  transition: background-size 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.page-footer .footer-top .list-wrapper a:hover,
.page-footer .footer-top .list-wrapper a:focus-visible {
  background-size: 100% 2px;
}

.page-footer .footer-top .footer-stamp {
  grid-area: stamp;
  justify-self: end;
  max-width: 100%;
}

.page-footer #ssb-evul-stamp {
  margin: 0;
  max-width: 100%;
}

.page-footer #ssb-evul-stamp img {
  max-width: 100%;
  height: auto;
}

/* --- Kontaktitulbad ----------------------------------------------------- */

.page-footer .footer-contacts {
  --ft-cols: var(--ft-count, 4);
  display: grid;
  grid-template-columns: repeat(var(--ft-cols), minmax(0, 1fr));
  gap: clamp(40px, 4vw, 56px) var(--ft-col-gap);
}

.page-footer .footer-contacts .group-list {
  position: relative;
  min-width: 0;
  padding-top: clamp(20px, 1.8vw, 28px);
  font-family: Roboto, sans-serif;
  font-size: var(--ft-text);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ft-muted);
  overflow-wrap: anywhere;
}

/* Kivilõike joon + punane märk iga tulba kohal */
.page-footer .footer-contacts .group-list::before,
.page-footer .footer-contacts .group-list::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
}

.page-footer .footer-contacts .group-list::before {
  right: 0;
  height: 1px;
  background: var(--ft-line);
}

.page-footer .footer-contacts .group-list::after {
  top: -1px;
  width: 70px;
  height: 3px;
  background: var(--ft-accent);
  transform-origin: left center;
}

.page-footer .footer-contacts .group-list strong,
.page-footer .footer-contacts .group-list h2,
.page-footer .footer-contacts .group-list h3,
.page-footer .footer-contacts .group-list h4,
.page-footer .footer-contacts .group-list h5 {
  display: block;
  margin: 0 0 8px;
  font-family: Raleway, sans-serif;
  font-size: var(--ft-title);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--ft-ink);
}

/* Mitu pealkirja ühes tulbas (nt mitu salongi) – vahe eelmisest plokist */
.page-footer .footer-contacts .group-list * + strong,
.page-footer .footer-contacts .group-list * + h3,
.page-footer .footer-contacts .group-list * + h4 {
  margin-top: 1.1em;
}

.page-footer .footer-contacts .group-list p,
.page-footer .footer-contacts .group-list ul,
.page-footer .footer-contacts .group-list ol {
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}

.page-footer .footer-contacts .group-list p:last-child,
.page-footer .footer-contacts .group-list ul:last-child,
.page-footer .footer-contacts .group-list ol:last-child {
  margin-bottom: 0;
}

.page-footer .footer-contacts .group-list li,
.page-footer .footer-contacts .group-list a {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

.page-footer .footer-contacts .group-list li {
  margin: 0 0 2px;
}

.page-footer .footer-contacts .group-list a {
  color: var(--ft-ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(var(--ft-accent), var(--ft-accent)) no-repeat left bottom / 0 1px;
  transition: background-size 0.35s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.page-footer .footer-contacts .group-list a:hover,
.page-footer .footer-contacts .group-list a:focus-visible {
  color: var(--ft-ink);
  background-size: 100% 1px;
}

.page-footer .footer-contacts .group-list img {
  max-width: 100%;
  height: auto;
}

.page-footer .footer-container a:focus-visible {
  outline: 2px solid var(--ft-accent);
  outline-offset: 3px;
}

/* --- Sisenemise animatsioon (ainult toetavates brauserites) ------------- */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .page-footer .footer-contacts .group-list {
      animation: ft-rise linear both;
      animation-timeline: view();
      animation-range: entry 10% entry 70%;
    }

    .page-footer .footer-contacts .group-list::after {
      animation: ft-cut linear both;
      animation-timeline: view();
      animation-range: entry 40% entry 100%;
    }

    .page-footer .footer-contacts .group-list:nth-child(2) { animation-range: entry 15% entry 80%; }
    .page-footer .footer-contacts .group-list:nth-child(3) { animation-range: entry 20% entry 90%; }
    .page-footer .footer-contacts .group-list:nth-child(4) { animation-range: entry 25% entry 100%; }
    .page-footer .footer-contacts .group-list:nth-child(5) { animation-range: entry 30% entry 100%; }
  }
}

@keyframes ft-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes ft-cut {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* --- Responsive ---------------------------------------------------------- */

/* Sülearvuti / tahvel: 4 tulpa -> 2x2, 5 tulpa -> 3+2 */
@media (max-width: 1199px) {
  .page-footer .footer-contacts {
    --ft-cols: 3;
  }

  .page-footer .footer-contacts--n2,
  .page-footer .footer-contacts--n4 {
    --ft-cols: 2;
  }

  .page-footer .footer-contacts--n1 {
    --ft-cols: 1;
  }
}

/* Menüü läheb logo alla omale reale */
@media (max-width: 991px) {
  .page-footer .footer-top {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "logo  stamp"
      "menu  menu";
  }

  .page-footer .footer-top .list-wrapper {
    justify-self: start;
  }

  .page-footer .footer-container::before {
    background-position: right -200px top -40px;
  }
}

@media (max-width: 767px) {
  .page-footer .footer-contacts {
    --ft-cols: 2;
  }

  .page-footer .footer-contacts--n1 {
    --ft-cols: 1;
  }

  /* Pikas mobiilifooteris sooned ka alla, et taust ei jääks tühjaks */
  .page-footer .footer-container::before {
    background:
      url(../img/Group.png) no-repeat right -420px top -30px / 1100px auto,
      url(../img/Group.png) no-repeat left -380px bottom -60px / 1100px auto;
    opacity: 0.28;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* Telefon: kõik üks tulp, suuremad puutealad */
@media (max-width: 559px) {
  .page-footer .footer-top {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "logo"
      "menu"
      "stamp";
  }

  .page-footer .footer-top .footer-stamp {
    justify-self: start;
  }

  .page-footer .footer-top .list-wrapper ul {
    gap: 2px 28px;
  }

  .page-footer .footer-top .list-wrapper a {
    padding: 10px 0;
  }

  .page-footer .footer-contacts,
  .page-footer .footer-contacts--n2,
  .page-footer .footer-contacts--n4 {
    --ft-cols: 1;
    row-gap: 36px;
  }

  .page-footer .footer-contacts .group-list a {
    display: inline-block;
    padding: 3px 0;
  }
}
