main > header nav.languages, .languages {
  display: flex;
  align-items: center;
  gap: .15rem;
  font: 500 .85rem/1 Aeonik, Arial, sans-serif;
}
.languages a {
  display: inline-grid;
  min-width: 2rem;
  min-height: 44px;
  place-items: center;
  color: inherit;
  text-decoration: none;
}
.languages a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: .35em;
  text-decoration-thickness: 2px;
}
.case-navigation {display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;}
#alku > main > header {
  font-size: clamp(15px, 1.35vw, 19px);
  display: grid;
  /* Reserve the contact column while the link is fixed to the viewport. */
  grid-template-columns: minmax(max-content, 1fr) max-content max-content clamp(9rem, 14vw, 12rem);
  z-index: 20;
  grid-template-areas: "brand primary languages contact";
  column-gap: clamp(12px, 2vw, 32px);
  row-gap: 0;
  align-items: center;
}
#alku > main > header .home-link {
  grid-area: brand;
  justify-self: start;
  align-items: center;
  min-height: 44px;
}
/* The stacked logo hides "Helsinki" when drawn under 120 px wide, so the header keeps it at 120 px or more; only phones under 360 px show KLIK alone. */
#alku > main > header .logo { width: clamp(120px, 9vw, 136px); }
@media (max-width: 359px) { #alku > main > header .logo { width: 96px; } }
#alku > main > header nav {
  display: flex;
  gap: clamp(10px, 1.5vw, 24px);
  align-items: center;
}
#alku > main > header nav:not(.languages) { grid-area: primary; font-size: inherit; }
#alku > main > header .languages {
  grid-area: languages;
  gap: 0;
  font-size: .75em;
  font-weight: 400;
  letter-spacing: .035em;
}
#alku > main > header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  white-space: nowrap;
  text-decoration: none;
}
#alku > main > header .languages a {
  min-width: 2.3em;
}
.languages a + a::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  height: .9em;
  border-inline-start: 1px solid currentColor;
  transform: translateY(-50%) skewX(-16deg);
  opacity: .65;
  pointer-events: none;
}
.languages a { position: relative; }
#alku > main > header nav a:is(:hover, :focus-visible, [aria-current="page"]) {
  text-decoration: underline;
  text-underline-offset: .3em;
}
.menu-contact {
  --contact-inset: var(--sivureuna, var(--gutter));
  position: fixed;
  z-index: 20;
  inset-block-start: max(var(--contact-inset), env(safe-area-inset-top));
  inset-inline-end: max(var(--contact-inset), env(safe-area-inset-right));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--klik-kerma) 65%, transparent);
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: .65em 1.2em;
  /* Speech bubble: the only rounded shape on the site marks the contact action */
  border-radius: 1.55em 1.55em .25em 1.55em;
  background: var(--klik-muste);
  color: var(--klik-kerma);
  font: 500 clamp(14px, 1.25vw, 18px)/1.15 Aeonik, Arial, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}
.menu-contact span {
  grid-area: 1 / 1;
  transition: opacity 140ms ease;
}
.menu-contact span:last-child {opacity: 0;}
.menu-contact:focus-visible span:first-child {opacity: 0;}
.menu-contact:focus-visible span:last-child {opacity: 1;}
@media (hover: hover) {
  .menu-contact:hover span:first-child {opacity: 0;}
  .menu-contact:hover span:last-child {opacity: 1;}
}
@media (max-height: 480px) {
  #sisalto .opening { padding-block-start: calc(var(--sivureuna) + 88px + 1rem); }
}
@media (max-width: 650px) {
  #alku > main > header {
    grid-template-columns: max-content max-content 1fr;
    grid-template-areas: "brand . contact" "primary languages .";
    gap: .2rem clamp(6px, 2.5vw, 16px);
  }
  #alku > main > header nav:not(.languages) { gap: clamp(5px, 1.8vw, 12px); }
  #alku > main > header nav:not(.languages) a:first-child { justify-content: flex-start; }
  #alku > main > header .languages a { min-width: clamp(28px, 8vw, 44px); }
}
@media (max-width: 359px) {
  #alku > main > header { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-contact span {transition: none;}
}
@media (max-width: 480px) {
  /* Phones: languages share the top row, so the four menu links get a row of their own */
  #alku > main > header { grid-template-columns: max-content 1fr max-content; grid-template-areas: "brand languages contact" "primary primary primary"; }
  #alku > main > header .languages { justify-self: start; margin-left: clamp(4px, 2vw, 16px); }
  #alku > main > header .languages a { min-width: 24px; }
  #alku > main > header nav:not(.languages) { gap: clamp(8px, 3vw, 16px); }
}
/* Square corners are the default again (Ville 24.11.2026 klo 14.45: "vaihda pyöristetyt kulmat suoriksi"). ?nappi=superellipsi brings these superellipse corners back for comparison.
   Four superellipse corners plus two rectangles form a mask, so the shape works in Safari and Chrome.
   --se is the absolute path of the corner image so the same rule works on every page depth. */
html.nappi-superellipsi :is(.menu-contact, .ek-base, .ek-biz, .ek-check-wrap, .ek-faq, .ek-link, #klikway li, #tekijatavat, .pack-matrix thead th, #muut-palvelut a, #edellinen, #seuraava, .contact-form button, .ek-qa > div, .story-card, .feature, .steps img, .results li, .quote, .next-story, .package-card, .step-card) {
  --r: 44px;
  border-radius: 0 !important; box-shadow: none;
  -webkit-mask:
    url("/etusivu/superellipsi.svg") 0 0 / var(--r) var(--r) no-repeat,
    url("/etusivu/superellipsi.svg") 100% 0 / var(--r) var(--r) no-repeat,
    url("/etusivu/superellipsi.svg") 0 100% / var(--r) var(--r) no-repeat,
    url("/etusivu/superellipsi.svg") 100% 100% / var(--r) var(--r) no-repeat,
    linear-gradient(#000, #000) 50% 50% / calc(100% - var(--r)) 100% no-repeat,
    linear-gradient(#000, #000) 50% 50% / 100% calc(100% - var(--r)) no-repeat;
  mask:
    url("/etusivu/superellipsi.svg") 0 0 / var(--r) var(--r) no-repeat,
    url("/etusivu/superellipsi.svg") 100% 0 / var(--r) var(--r) no-repeat,
    url("/etusivu/superellipsi.svg") 0 100% / var(--r) var(--r) no-repeat,
    url("/etusivu/superellipsi.svg") 100% 100% / var(--r) var(--r) no-repeat,
    linear-gradient(#000, #000) 50% 50% / calc(100% - var(--r)) 100% no-repeat,
    linear-gradient(#000, #000) 50% 50% / 100% calc(100% - var(--r)) no-repeat;
}
html.nappi-superellipsi :is(.menu-contact, .ek-link, #edellinen, #seuraava, .contact-form button) { --r: 1.9em !important; }
html.nappi-superellipsi .steps img { --r: 36px; }
/* Menu links keep their 44 px tap height, but their width follows the word so the gaps stay even */
#alku > main > header nav:not(.languages) a { min-width: 0; padding-inline: .15em; }
/* The mask would cut a border off at the curve, so masked cards drop their outline (no divider lines in the brand).
   Form fields keep a border and use a plain radius instead of the mask. */
html.nappi-superellipsi :is(.ek-biz, .ek-check-wrap, .ek-faq, .ek-qa > div, #tekijatavat) { border: 0 !important; }
html.nappi-superellipsi .contact-form :is(input, textarea) { border-radius: .7em !important; }
/* Package names are separate superellipse tabs; a small gap between columns lets the corners show */
html.nappi-superellipsi .pack-matrix { border-collapse: separate; border-spacing: clamp(6px, .8vw, 10px) 0; }
html.nappi-superellipsi .pack-matrix thead th { --r: 26px !important; }
/* Square default also for the work-model table headers. */
html:not(.nappi-superellipsi) .work-models :is(th, td) { border-radius: 0 !important; }
html:not(.nappi-superellipsi) .contact-form :is(input, textarea, button) { border-radius: 0 !important; }
/* 24.11.2026: the hero carries the operating principle (Ville: "ei klikistä vaan siitä millä ajatuksella klik operoi"), a longer line than before. */
.opening h1.periaate {font-size: clamp(56px, 9vw, 160px); max-width: 11ch; line-height: .98;}
.opening h1.periaate em {display: inline;}
@media (max-width: 700px) {.opening h1.periaate {font-size: clamp(48px, 14vw, 76px);}}

/* Menu contact button square too (Ville 24.11.2026: "vaihda tääkin kulmikkaaksi"). */
.menu-contact {border-radius: 0 !important;}

/* Longer hero line (Ville 24.11.2026): smaller on desktop so it ends before the 3D cursor. */
@media (min-width: 701px) {.opening h1.periaate {font-size: clamp(52px, 6.4vw, 120px); max-width: 13ch;}}

/* "Ole se poikkeus." on its own unbroken line (Ville 24.11.2026). */
.opening h1.periaate em {display: block; white-space: nowrap;}
@media (max-width: 700px) {.opening h1.periaate {font-size: min(clamp(48px, 14vw, 76px), 12.5vw);}}

/* Compact sticky menu (Ville 25.11.2026: "saisko menun pysymään mukana kun skrollaa alaspäin samalla kapeudella kuin
   hasanpartners.fi"). Past the top of the page the header becomes a 57 px orange bar fixed to the top, like that site's
   bar; at the top it returns to the full transparent header. toimitus.js toggles html.valikko-kiinni. */
html.valikko-kiinni #alku > main > header {
  position: fixed;
  inset: 0 0 auto 0;
  width: auto;
  height: 57px;
  box-sizing: border-box;
  padding: 0 var(--valikko-reuna, 24px);
  grid-template-rows: 57px;
  background: var(--klik-oranssi, #f35c35);
  color: var(--klik-muste, #201b20);
  z-index: 30;
  font-size: clamp(14px, 1.1vw, 16px);
  animation: valikko-sisaan .28s cubic-bezier(.2, .8, .2, 1);
}
html.valikko-kiinni #alku > main > header .logo { width: 120px; }
html.valikko-kiinni #alku > main > header .home-link { min-height: 0; }
html.valikko-kiinni .menu-contact { inset-block-start: 6.5px; z-index: 31; font-size: clamp(13px, 1.05vw, 15px); }
@keyframes valikko-sisaan { from { transform: translateY(-100%); } to { transform: none; } }
@media (max-width: 650px) {
  /* Phones: logo, languages and the contact button fit the bar; the page links stay in the full header at the top. */
  html.valikko-kiinni #alku > main > header { grid-template-columns: max-content 1fr max-content; grid-template-areas: "brand languages contact"; }
  html.valikko-kiinni #alku > main > header nav:not(.languages) { display: none; }
  html.valikko-kiinni #alku > main > header .languages { justify-self: start; margin-left: 12px; }
}
@media (max-width: 359px) { html.valikko-kiinni #alku > main > header .logo { width: 96px; } }
@media (prefers-reduced-motion: reduce) { html.valikko-kiinni #alku > main > header { animation: none; } }

/* FI / EN / SV sits midway between the last menu link and the Klikkaa tästä button (Ville 25.11.2026: "fi en sv
   pitäisi olla yhtä kaukana klikkaa tästä napista kuin ota yhteyttä tekstistä"). Measured from the visible text:
   the switcher moves right until both gaps match (1.63 vw after tightening). Desktop row layout only. */
@media (min-width: 651px) {
  /* Tighter package (Ville: "sen pitäisi viedä vähemmän tilaa"): the links hug their letters; the click area keeps
     its full 44 px height. */
  #alku > main > header .languages a { min-width: 0; padding-inline: .38em; }
  #alku > main > header .languages { margin-inline-start: var(--kielet-siirto, 1.63vw); }
}

/* Hero: "Somea, / jota ei skipata." with only "ei skipata." in bold (Ville 26.11.2026). The second line is its own
   block, and the bold part stays inline in it. */
.opening h1.periaate .lupaus-rivi {display: block; white-space: nowrap;}
.opening h1.periaate .lupaus-rivi em {display: inline;}
