/* KPMS — kpms-pr.eu
   Tokenid on üle võetud WordPressi teema (Bricks + Automatic.css) seadistusest,
   et staatiline leht näeks välja sama. */

@font-face {
  font-family: "DomaineDisplayWeb";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/DomaineDisplayWeb-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "DomaineDisplayWeb";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/DomaineDisplayWeb-Semibold.woff2") format("woff2");
}
@font-face {
  font-family: "HKGrotesk";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/HKGrotesk-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "HKGrotesk";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/HKGrotesk-SemiBold.woff2") format("woff2");
}

:root {
  /* Värvid */
  --navy: #05284c;
  --navy-dark: #031930;
  --red: #ff0046;
  --red-dark: #d6003b;
  --white: #fff;
  --line: rgb(5 40 76 / 0.22);
  --line-strong: rgb(5 40 76 / 0.45);
  --ok-bg: #e7f4ec;
  --ok-text: #0d5a2c;
  --error-bg: #ffe5ec;

  /* Kirjad */
  --font-text: "HKGrotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "DomaineDisplayWeb", Georgia, "Times New Roman", serif;

  --text-xs: 0.75rem;
  --text-s: clamp(0.8125rem, calc(0.05vw + 0.8012rem), 0.844rem);
  --text-m: clamp(1rem, calc(0.1988vw + 0.9553rem), 1.125rem);
  --text-l: clamp(1.2rem, calc(0.4765vw + 1.0928rem), 1.4996rem);
  --h1: clamp(1.944rem, calc(2.5589vw + 1.3683rem), 3.5529rem);
  --h2: clamp(1.62rem, calc(1.6626vw + 1.2459rem), 2.6653rem);
  --h3: clamp(1.35rem, calc(1.033vw + 1.1176rem), 1.9995rem);
  --hero: clamp(3rem, calc(1rem + 5vw), 5.2rem);

  /* Vahed */
  --space-xs: 0.84rem;
  --space-s: clamp(1.1253rem, calc(0.1984vw + 1.0807rem), 1.25rem);
  --space-m: clamp(1.5rem, calc(0.5964vw + 1.3658rem), 1.875rem);
  --space-l: clamp(1.9995rem, calc(1.293vw + 1.7086rem), 2.8125rem);
  --section-space: clamp(3rem, calc(4.175vw + 2.0606rem), 5.625rem);
  --gutter: clamp(1rem, calc(6.3618vw - 0.4314rem), 5rem);
  --content-width: 85.375rem;

  --radius: 2px;
}

/* Põhi */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-text);
  font-size: var(--text-m);
  line-height: calc(6px + 2ex);
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: calc(4px + 2ex);
  color: var(--navy);
  text-wrap: balance;
}

p {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

strong {
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.highlight {
  color: var(--red);
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--navy);
  color: var(--white);
  font-size: var(--text-s);
  transform: translateY(-120%);
}
.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Paigutus */
.section {
  padding: var(--section-space) var(--gutter);
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
}

.container--narrow {
  max-width: var(--content-width);
}
.container--narrow > * {
  max-width: 50rem;
}

.container--prose {
  max-width: var(--content-width);
}
.container--prose .prose {
  max-width: 46rem;
}

.section--texture {
  background: #f1f1f1 url("/assets/img/bg-gray.jpg") center / cover;
}

/* Päis */
.site-header {
  padding: var(--space-s) var(--gutter);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
}

.brand img {
  width: 100px;
}

.brand__cities {
  font-size: var(--text-xs);
  line-height: 1.2;
}

.lang-switch ul {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-switch li + li::before {
  content: "/";
  display: inline-block;
  margin-inline: clamp(0.3rem, 1.2vw, 0.75rem);
  opacity: 0.6;
}

.lang-switch a {
  display: inline-block;
  padding: 0.5rem 0.25rem;
  text-decoration: none;
}

.lang-switch a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.lang-switch a[aria-current="page"] {
  color: var(--red);
}

/* Nupp */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.75rem;
  min-height: 2.75rem;
  padding: 0.75em 1.5em;
  border: 0;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn:hover {
  background: var(--red-dark);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.btn--small {
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.6em 1.1em;
  font-size: var(--text-s);
}

.btn--navy {
  background: var(--navy);
}
.btn--navy:hover {
  background: var(--navy-dark);
}

.btn--outline {
  background: transparent;
  color: var(--navy);
  box-shadow: inset 0 0 0 2px var(--navy);
}
.btn--outline:hover {
  background: rgb(5 40 76 / 0.06);
}

/* Avaleht */
.hero {
  flex: 1;
  display: flex;
  align-items: center;
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: var(--space-xl) clamp(2rem, 5vw, 5rem);
}

.hero__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero__title {
  max-width: 800px;
  font-size: clamp(3rem, calc(1rem + 3.9vw), 4.75rem);
}

.hero__lead {
  max-width: 540px;
  margin-top: var(--space-l);
  font-size: var(--text-l);
  line-height: 1.25;
}

.hero__cta {
  margin-top: var(--space-l);
}

/* Avaleht — Balti kaart päises */
.hero__map {
  justify-self: end;
  width: 100%;
  max-width: 30rem;
}

@media (max-width: 900px) {
  .hero__inner {
    grid-template-columns: 1fr;
  }
  .hero__map {
    justify-self: center;
    max-width: 22rem;
  }
}

.baltic-map {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(38rem, 74vh);
  overflow: visible;
}

.map-land {
  fill: rgb(5 40 76 / 0.06);
}

.map-country {
  fill: #dfe5ec;
  stroke: var(--white);
  stroke-width: 1.4;
  stroke-linejoin: round;
  transition: fill 0.35s ease, filter 0.35s ease;
}

.map-lakes {
  fill: var(--white);
}

.map-country-label {
  fill: rgb(5 40 76 / 0.5);
  font-family: var(--font-text);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-anchor: middle;
}

.map-city__dot {
  fill: var(--red);
  stroke: var(--white);
  stroke-width: 2;
}

.map-city__pulse {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.5;
  opacity: 0;
}

.map-city__dot,
.map-city__pulse {
  transform-box: fill-box;
  transform-origin: center;
}

.map-city__label {
  fill: var(--navy);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  paint-order: stroke;
  stroke: rgb(255 255 255 / 0.7);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* Riigi suumimine hiirega. Suumi keskpunkti seab JavaScript (map-interactive). */
.map-interactive .map-country-group {
  transform-box: view-box;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.map-interactive .map-country-group:hover {
  transform: scale(1.08);
}

.map-interactive .map-country-group:hover .map-country {
  fill: #cdd6e1;
  filter: drop-shadow(0 6px 10px rgb(5 40 76 / 0.22));
}

@media (prefers-reduced-motion: no-preference) {
  .map-city__pulse {
    animation: map-pulse 2.8s ease-out infinite;
  }
  .map-city--2 .map-city__pulse { animation-delay: 0.9s; }
  .map-city--3 .map-city__pulse { animation-delay: 1.8s; }
}

@keyframes map-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3.6); opacity: 0; }
}

/* Alamlehtede pealkirjad */
.page-title {
  margin-bottom: var(--space-m);
  font-size: var(--h1);
}

.section-title {
  font-size: var(--h2);
}

.intro {
  margin-top: var(--space-s);
  font-size: var(--text-l);
  line-height: 1.35;
}

/* Kontakt — partnerid */
.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 40px;
}

.team-photo {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.team-photo--1 { grid-column: 1; grid-row: 1 / span 2; }
.partner--1    { grid-column: 2; grid-row: 1; }
.team-photo--2 { grid-column: 3; grid-row: 1 / span 2; }
.partner--2    { grid-column: 2; grid-row: 2; }

.partner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.partner--2 {
  align-items: flex-end;
  text-align: right;
}

.partner__name {
  font-size: var(--h3);
}

.partner__contacts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.partner__contacts a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.3rem;
  text-decoration: none;
}

.partner--2 .partner__contacts a {
  flex-direction: row-reverse;
}

.partner__contacts a:hover span {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.partner__contacts svg {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 991px) {
  .team-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
  .team-photo--1 { grid-column: 1; grid-row: 1; }
  .partner--1    { grid-column: 2; grid-row: 1; }
  .team-photo--2 { grid-column: 1; grid-row: 2; }
  .partner--2    { grid-column: 2; grid-row: 2; }

  .partner--2 {
    align-items: flex-start;
    text-align: left;
  }
  .partner--2 .partner__contacts a {
    flex-direction: row;
  }
}

@media (max-width: 478px) {
  .team-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .team-photo--1 { grid-column: 1; grid-row: 1; }
  .partner--1    { grid-column: 1; grid-row: 2; }
  .team-photo--2 { grid-column: 1; grid-row: 3; margin-top: var(--space-m); }
  .partner--2    { grid-column: 1; grid-row: 4; }
}

.partner__role {
  margin-top: -0.35rem;
  font-size: var(--text-s);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Kontakt — 3 või rohkem inimest: vahelduv astmeline paigutus.
   Iga järgmine inimene algab eelmise foto poole kõrguselt (fotod on eri tulpades). */
.team-cascade {
  --gap: 40px;
  display: flex;
  flex-direction: column;
}

.cascade-item {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  column-gap: var(--gap);
  pointer-events: none;
}

.cascade-item > * {
  pointer-events: auto;
}

/* Protsent on konteineri laiusest: foto kõrgus = 1,5 × tulba laius, nihe = pool sellest */
.cascade-item + .cascade-item {
  margin-top: calc((100% - 2 * var(--gap)) / 3 * -0.75 + var(--gap) / 2);
}

.cascade-item--left .team-photo { grid-column: 1; grid-row: 1; }
.cascade-item--left .partner    { grid-column: 2; grid-row: 1; }
.cascade-item--right .team-photo { grid-column: 3; grid-row: 1; }
.cascade-item--right .partner {
  grid-column: 2;
  grid-row: 1;
  align-items: flex-end;
  text-align: right;
}
.cascade-item--right .partner__contacts a {
  flex-direction: row-reverse;
}

@media (max-width: 991px) {
  .team-cascade {
    gap: 30px;
  }
  .cascade-item {
    grid-template-columns: 1fr 1fr;
    column-gap: 30px;
  }
  .cascade-item + .cascade-item {
    margin-top: 0;
  }
  .cascade-item--left .partner   { grid-column: 2; }
  .cascade-item--right .partner  { grid-column: 1; }
  .cascade-item--right .team-photo { grid-column: 2; }
}

@media (max-width: 478px) {
  .team-cascade {
    gap: var(--space-l);
  }
  .cascade-item {
    grid-template-columns: 1fr;
    row-gap: 24px;
  }
  .cascade-item .team-photo,
  .cascade-item .partner {
    grid-column: 1;
  }
  .cascade-item .partner {
    grid-row: 2;
  }
  .cascade-item--right .partner {
    align-items: flex-start;
    text-align: left;
  }
  .cascade-item--right .partner__contacts a {
    flex-direction: row;
  }
}

/* Kontakt — vorm */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: var(--space-l);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.req {
  color: var(--red);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  font: inherit;
  line-height: 1.4;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgb(5 40 76 / 0.5);
}

.field input:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus-visible,
.field textarea:focus-visible {
  border-color: var(--navy);
  outline: 2px solid var(--navy);
  outline-offset: 0;
}

.form-note {
  font-size: var(--text-s);
}

.contact-form .btn {
  align-self: flex-start;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.notice {
  display: none;
  padding: 0.9rem 1rem;
  border-left: 3px solid currentColor;
  font-size: var(--text-m);
}
.notice:target,
.notice.is-visible {
  display: block;
}
.notice--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.notice--error {
  background: var(--error-bg);
  color: var(--navy);
  border-left-color: var(--red);
}

/* Privaatsustingimused */
.prose > * + * {
  margin-top: 1em;
}

.prose h2 {
  margin-top: 1.6em;
  font-size: var(--h3);
}

.prose h2 + p {
  margin-top: 0.6em;
}

.prose__meta {
  font-size: var(--text-s);
  opacity: 0.75;
}

.prose ul {
  margin-bottom: 0;
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--red);
}

.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.prose a:hover {
  color: var(--red);
}

/* 404 */
.error-page {
  flex: 1;
  display: flex;
  align-items: center;
}
.error-page__texts {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-l);
  line-height: 1.35;
}
.error-page__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-l);
}

/* Jalus */
.site-footer {
  padding: 15px var(--gutter);
  font-size: var(--text-s);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.site-footer a,
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.site-footer a:hover,
.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-footer a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Küpsiste nõusolek */
.consent {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  width: min(26rem, calc(100% - 2rem));
  padding: 1.25rem;
  border-radius: 6px;
  background: var(--white);
  color: var(--navy);
  font-size: var(--text-s);
  box-shadow: 0 10px 40px rgb(5 40 76 / 0.22), 0 0 0 1px rgb(5 40 76 / 0.06);
}

.consent[hidden] {
  display: none;
}

.consent__title {
  margin-bottom: 0.4rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}

.consent__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.consent__actions .btn {
  flex: 1;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media print {
  .site-header .lang-switch,
  .consent,
  .contact-form {
    display: none;
  }
}
