/* HIO Labs Oy — hiolabs.fi
   Ei build-vaihetta, ei riippuvuuksia, ei ulkoisia pyyntöjä.
   Fontit: IBM Plex (OFL-1.1), tarjoillaan omasta /fonts-hakemistosta.
   Paletti on johdettu HIO Labsin tunnuksesta.
   Kaikki liike on CSS:ää — ei riviäkään JavaScriptiä. */

/* ---------- Fontit ---------- */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokenit ---------- */

:root {
  /* Tunnuksesta poimitut värit */
  --navy:       #122f5d;
  --steel:      #2b64a4;
  --steel-deep: #1e4b7d;

  --paper:      #eaeef3;
  --paper-tint: #e1e7ef;
  --ink:        #0c1a2e;
  --ink-muted:  #4a5768;
  --rule:       #d2dae3;
  --rule-firm:  #b7c2cf;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "Cascadia Mono",
          Consolas, "Liberation Mono", monospace;

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --ease: cubic-bezier(0.2, 0.65, 0.25, 1);
  --radius: 10px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.page {
  max-width: 58rem;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 7vw, 5rem);
}

/* ---------- Liikkeen perusteet ---------- */

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

@keyframes draw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes settle {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Yläpalkki ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  animation: settle 0.5s var(--ease) both;
}

.topbar__logo {
  width: auto;
  height: 1.85rem;
}

/* Kielenvaihto */

.lang {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}

.lang__current {
  color: var(--navy);
  font-weight: 600;
}

.lang__sep {
  width: 1px;
  height: 0.75rem;
  background: var(--rule-firm);
}

.lang__link {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.lang__link:hover { color: var(--steel); }

.lang__link:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Viiva ilmestyy vasta kun sivua on vieritetty. */
@supports (animation-timeline: scroll()) {
  .topbar {
    animation-name: settle, topbar-rule;
    animation-duration: 0.5s, auto;
    animation-timing-function: var(--ease), linear;
    animation-fill-mode: both, both;
    animation-timeline: auto, scroll(root);
    animation-range: normal, 0 96px;
  }
}

@keyframes topbar-rule {
  from { border-bottom-color: transparent; }
  to   { border-bottom-color: var(--rule); }
}

/* ---------- Masthead ---------- */

.masthead {
  padding: clamp(3.5rem, 11vw, 7rem) 0 clamp(2.75rem, 7vw, 4.5rem);
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.25rem, 7.5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
  animation: rise 0.7s var(--ease) 0.1s both;
}

.masthead__rule {
  width: 5.5rem;
  height: 2px;
  margin: clamp(1.5rem, 3.5vw, 2rem) 0 0;
  background: var(--steel);
  transform-origin: left center;
  animation: draw 0.7s var(--ease) 0.45s both;
}

/* Tagline — sivun ainoa display-kokoinen väite.
   Sanat nousevat esiin peräkkäin sivun latautuessa. */

.tagline {
  margin: clamp(1.5rem, 3.5vw, 2.25rem) 0 0;
  max-width: 17ch;
  font-size: clamp(1.5rem, 4.6vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.14;
  color: var(--navy);
}

.tagline__w {
  display: inline-block;
  animation: rise 0.65s var(--ease) both;
}

.tagline__w--brand { color: var(--steel); }

.tagline__w:nth-child(1) { animation-delay: 0.40s; }
.tagline__w:nth-child(2) { animation-delay: 0.50s; }
.tagline__w:nth-child(3) { animation-delay: 0.60s; }
.tagline__w:nth-child(4) { animation-delay: 0.70s; }

/* ---------- Rivirakenne ---------- */

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  padding: clamp(2.5rem, 6vw, 3.75rem) 0;
  border-top: 1px solid var(--rule);
}

.row__label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.row__body { min-width: 0; }
.row__body > :first-child { margin-top: 0; }
.row__body > :last-child { margin-bottom: 0; }

/* Avausosio ilman tunnistetta — koko leveys, hieman isompi teksti. */

.row--intro { border-top: 0; padding-top: 0; }

.intro {
  margin: 0;
  max-width: 54ch;
  font-size: clamp(1.125rem, 2.1vw, 1.35rem);
  line-height: 1.5;
  text-wrap: pretty;
}

@media (min-width: 46rem) {
  .row {
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 2.5rem;
  }
  .row--intro { grid-template-columns: 1fr; }
  /* Tunniste seuraa mukana osion ajan. */
  .row__label {
    position: sticky;
    top: 4.5rem;
    align-self: start;
    padding-top: 0.35rem;
  }
}

/* ---------- Vierityksen mukana ilmestyvät elementit ----------
   Vain jos selain tukee scroll-sidonnaista aikajanaa. Muuten
   sisältö on aina näkyvissä — se ei voi jäädä piiloon. */

@supports (animation-timeline: view()) {
  .intro,
  .row__body > p,
  .product__head,
  .shot,
  .service,
  .record__row {
    animation-name: rise;
    animation-duration: auto;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: view();
    animation-range: entry 4% entry 38%;
  }
}

/* ---------- Teksti ---------- */

p {
  margin: 0 0 1.1rem;
  max-width: 62ch;
}

h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

/* ---------- Palvelulista ---------- */

.services { margin: 0; }

.service {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.15rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.service:first-child { padding-top: 0; }
.service:last-child { border-bottom: 0; padding-bottom: 0; }

.service__icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  width: 1.9rem;
  height: 1.9rem;
  color: var(--steel);
  transition: color 0.25s var(--ease), transform 0.35s var(--ease);
}

.service__icon svg { width: 100%; height: 100%; display: block; }

.service dt {
  grid-column: 2;
  grid-row: 1;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 0.3rem;
  transition: color 0.25s var(--ease);
}

.service dd {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  max-width: 62ch;
  color: var(--ink-muted);
}

.service:hover dt { color: var(--steel); }

.service:hover .service__icon {
  color: var(--steel-deep);
  transform: translateY(-2px);
}

/* Kuvakkeiden viivat piirtyvät kun osio tulee näkyviin. */
@supports (animation-timeline: view()) {
  .service__icon svg > * {
    stroke-dasharray: 1;
    animation-name: trace;
    animation-duration: auto;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: view();
    animation-range: entry 12% entry 60%;
  }
}

@keyframes trace {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

/* ---------- Tuote ---------- */

.product__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.product__mark {
  width: 2.75rem;
  height: 2.75rem;
  transition: transform 0.4s var(--ease);
}

.product__head:hover .product__mark { transform: translateY(-3px) rotate(-4deg); }

.shot {
  margin: 2rem 0;
  border: 1px solid var(--rule-firm);
  border-radius: var(--radius);
  overflow: hidden;
}

.shot img {
  width: 100%;
  transition: transform 0.6s var(--ease);
}

.shot:hover img { transform: scale(1.035); }

/* Julkaisutieto — merkitty faktaksi, ei leipätekstiksi. */

.release {
  margin: 1.75rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--steel);
  max-width: 52ch;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

/* Tuotelinkki — oma rivinsä, ei leipätekstiä. */

.product-link {
  margin: 2.25rem 0 0;
  max-width: none;
  font-size: clamp(1.0625rem, 1.9vw, 1.2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.product-link a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.95rem 0.7rem;
  margin: 0 -0.7rem;
  border-top: 1px solid var(--rule-firm);
  border-bottom: 1px solid var(--rule-firm);
  border-radius: 6px;
  color: var(--steel);
  text-decoration: none;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.product-link a:hover {
  color: var(--steel-deep);
  background-color: var(--paper-tint);
}

.product-link__arrow {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  transition: transform 0.3s var(--ease);
}

.product-link a:hover .product-link__arrow { transform: translateX(5px); }

.product-link a:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
}

/* ---------- Yhteystiedot rekisteriotteena ---------- */

.contact-lead {
  font-size: clamp(1.0625rem, 1.9vw, 1.2rem);
  line-height: 1.5;
  max-width: 46ch;
  text-wrap: pretty;
}

.contact-mail {
  margin: 1.5rem 0 0;
  font-size: clamp(1.25rem, 3.2vw, 1.75rem);
  letter-spacing: -0.02em;
}

.contact-mail a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.record__title {
  margin: 3rem 0 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

address {
  font-style: normal;
  margin-top: 0.9rem;
}

.record {
  margin: 0;
  border-top: 1px solid var(--rule-firm);
}

.record__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  padding: 0.9rem 0.7rem;
  margin: 0 -0.7rem;
  border-bottom: 1px solid var(--rule);
  border-radius: 6px;
  transition: background-color 0.25s var(--ease);
}

.record__row:hover { background-color: var(--paper-tint); }

.record dt {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.record dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 34rem) {
  .record__row {
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: baseline;
  }
  .record dt { padding-top: 0.1rem; }
}

/* ---------- Linkit ---------- */

a {
  color: var(--steel);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: color 0.2s var(--ease), text-underline-offset 0.2s var(--ease),
              text-decoration-thickness 0.2s var(--ease);
}

a:hover {
  color: var(--steel-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

a:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
  border-radius: 2px;
  text-decoration: none;
}

/* ---------- Alatunniste ---------- */

footer {
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--rule-firm);
}

.footer__mark {
  width: 2.5rem;
  height: auto;
  margin-bottom: 1.4rem;
}

.footer__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

::selection {
  background: #c9d8e8;
  color: var(--ink);
}

/* ---------- Liikkeen vähentäminen ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .topbar { border-bottom-color: var(--rule); }
}

/* ---------- Tulostus ---------- */

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .page { max-width: none; padding: 0; }
  .topbar { position: static; }
  a { color: #000; }
  .row { break-inside: avoid; }
  .shot { break-inside: avoid; }
  * { animation: none !important; }
}
