/* Elolähde Consulting – sivuston tyylit. Värit ja typografia tulevat tokens.css:stä. */

/* Fontit itse hostattuna (SIL Open Font License). Muuttuvat fontit, latin + latin-ext.
   Tiedostonimessä on Google Fontsin versio (v4, v23): uusi versio = uusi nimi, siksi immutable-välimuisti. */
@font-face {
  font-family: "Albert Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/albert-sans-v4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Albert Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/albert-sans-v4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-v23-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-v23-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--color-brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-brand-hover);
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

svg {
  display: block;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background: var(--color-brand);
  color: var(--color-on-brand);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
}

.skip-link:focus {
  top: var(--space-3);
  color: var(--color-on-brand);
}

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

/* Merkki */
.mark .mark-arc {
  fill: none;
  stroke: var(--color-logo-arc);
  stroke-width: 10;
  stroke-linecap: round;
}

.mark .mark-dot {
  fill: var(--color-logo-dots);
}

/* Yläpalkki */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--color-text);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-text);
}

.brand .mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.wordmark {
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.wordmark b {
  font-weight: var(--weight-heading);
}

.wordmark span {
  font-weight: var(--weight-heading-light);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-5);
  font-size: 15px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  text-decoration: none;
  font-weight: 500;
}

.site-nav a:hover {
  text-decoration: underline;
}

/* Teemakytkin. Näkyy vasta, kun <head>in skripti on poistanut hidden-attribuutin. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  background: var(--color-surface);
}

.theme-toggle .icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle[aria-pressed="true"] .icon-moon,
.theme-toggle:not([aria-pressed="true"]) .icon-sun {
  display: none;
}

/* Osiot */
.section {
  padding-top: var(--space-section);
  padding-bottom: var(--space-section);
}

.section-title {
  font-size: var(--text-2xl);
  margin-bottom: clamp(28px, 4vw, 40px);
}

.section--surface {
  background: var(--color-surface);
}

/* Hero */
.hero {
  background: var(--color-surface);
}

.hero .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8);
  padding-top: var(--space-hero);
  padding-bottom: var(--space-hero);
}

.hero-copy {
  flex: 1 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
}

.eyebrow {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-accent-text);
}

.hero h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

.lead {
  font-size: var(--text-lg);
  color: var(--color-text-soft);
  max-width: 34em;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 48px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-sm);
  background: var(--color-brand);
  color: var(--color-on-brand);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
}

.button:hover {
  background: var(--color-brand-hover);
  color: var(--color-on-brand);
}

.hero-visual {
  flex: 0 1 420px;
  min-width: 0;
  display: flex;
  justify-content: center;
  container-type: inline-size;
}

/* Hero-animaatio: nimi muuttuu merkiksi.
   Ä:n pisteet jäävät paikalleen, kirjaimet häipyvät ja kaari piirtyy pisteiden ympärille.
   Mitat em-yksiköissä, jotta sama geometria skaalautuu kaikkiin kokoihin.
   Mitattu Albert Sans 650:stä (canvas-rasteri, 400 px): pisteiden keskikohta 0,2225 em rivin
   yläreunasta, halkaisija 0,11 em, keskipisteiden väli 0,157 em. Merkin pisteet (r 6,5, väli 19 / 100)
   osuvat ä:n pisteisiin, kun merkin koko on 0,826 em. Loppukoko 3,1 × 0,826 em = 2,56 em. */
.name-to-mark {
  --dot-y: 0.2225em;
  --dy: calc(0.5em - var(--dot-y));
  --dur: 3.2s;
  --delay: 0.6s;
  width: 100%;
  max-width: 480px;
  height: 2.8em;
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: clamp(56px, 20cqw, 96px);
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--color-text);
  user-select: none;
}

.name-to-mark .letters {
  flex: 1 1 0;
  min-width: 0;
  animation: ntm-letters var(--dur) var(--delay) ease-in-out forwards;
}

.name-to-mark .letters-l {
  text-align: right;
}

.name-to-mark .letters-r {
  text-align: left;
}

.name-to-mark .a {
  position: relative;
}

.name-to-mark .a .letters {
  flex: none;
}

.name-to-mark .hdot {
  position: absolute;
  width: 0.11em;
  height: 0.11em;
  border-radius: 50%;
  background: var(--color-logo-dots);
  top: calc(var(--dot-y) - 0.055em);
  animation: ntm-hdot var(--dur) var(--delay) linear forwards;
}

.name-to-mark .hdot-1 {
  left: calc(50% - 0.134em);
}

.name-to-mark .hdot-2 {
  left: calc(50% + 0.024em);
}

.name-to-mark .mark {
  position: absolute;
  width: 0.826em;
  height: 0.826em;
  left: calc(50% - 0.475em);
  top: calc(var(--dot-y) - 0.413em);
  overflow: visible;
  transform-origin: 57.5% 50%;
  opacity: 0;
  animation: ntm-mark var(--dur) var(--delay) cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.name-to-mark .mark-arc {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: ntm-arc var(--dur) var(--delay) cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes ntm-letters {
  0%, 15% { opacity: 1; }
  38%, 100% { opacity: 0; }
}

@keyframes ntm-hdot {
  0%, 38% { opacity: 1; }
  40%, 100% { opacity: 0; }
}

@keyframes ntm-mark {
  0%, 37% { opacity: 0; transform: translate(0, 0) scale(1); }
  40% { opacity: 1; transform: translate(0, 0) scale(1); }
  82%, 100% { opacity: 1; transform: translate(0.062em, var(--dy)) scale(3.1); }
}

@keyframes ntm-arc {
  0%, 42% { stroke-dashoffset: 100; }
  82%, 100% { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .name-to-mark .letters,
  .name-to-mark .hdot,
  .name-to-mark .mark,
  .name-to-mark .mark-arc {
    animation: none;
  }

  .name-to-mark .letters,
  .name-to-mark .hdot {
    opacity: 0;
  }

  .name-to-mark .mark {
    opacity: 1;
    transform: translate(0.062em, var(--dy)) scale(3.1);
  }

  .name-to-mark .mark-arc {
    stroke-dashoffset: 0;
  }
}

/* Kortit */
.grid {
  display: grid;
  gap: var(--space-5);
}

.grid--services {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid--projects {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) 28px;
  border-radius: var(--radius-lg);
}

.card h3 {
  font-size: 22px;
  line-height: 1.25;
}

.card p {
  font-size: 16px;
  color: var(--color-text-soft);
}

.card--service {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.card-num {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: var(--weight-heading);
  color: var(--color-accent-text);
}

.card--project {
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

/* Projektikortin kuva: 16:9, width/height HTML:ssä, joten tila varataan ennen latausta. */
.card-media {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

/* Projektin pyöreä logo otsikon vieressä. Koriste: nimi kerrotaan otsikossa. */
.card-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.card-head h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-logo {
  flex: none;
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-border);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.tag--live {
  border-color: transparent;
  background: var(--color-surface);
  color: var(--color-brand);
}

.card-link {
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: 15px;
  font-weight: 500;
}

/* Yhteys */
.contact {
  background: var(--color-bg-brand);
  color: var(--color-text-on-brand);
}

.contact .container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
}

.contact-copy {
  flex: 999 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
}

.contact p {
  color: var(--color-text-on-brand-soft);
  max-width: 32em;
}

.button--inverse {
  flex: 0 1 auto;
  min-height: 52px;
  background: var(--color-text-on-brand);
  color: var(--el-lahde);
  font-size: var(--text-md);
}

.contact a:not(.button) {
  color: var(--color-link-on-brand);
}

.contact :focus-visible {
  outline-color: var(--color-focus-on-brand);
}

.button--inverse:hover {
  background: var(--color-text-on-brand);
  color: var(--el-lahde-tumma);
}

/* Alatunniste */
.site-footer {
  background: var(--color-bg-footer);
  color: var(--color-text-footer);
  font-size: 14px;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding-top: 28px;
  padding-bottom: 28px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-footer .mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.site-footer .mark-arc {
  stroke: var(--color-logo-arc-footer);
}

.site-footer .mark-dot {
  fill: var(--color-logo-dots-footer);
}

.site-footer a {
  color: var(--color-link-footer);
}

.site-footer :focus-visible {
  outline-color: var(--color-focus-on-brand);
}

.site-footer a:hover {
  color: var(--el-lumi);
}

/* Pienet näytöt */
@media (max-width: 600px) {
  /* Kytkin jää valikon kanssa samalle riville oikeaan reunaan: näkyvä järjestys = fokusjärjestys. */
  .site-header .container {
    column-gap: var(--space-3);
  }

  .theme-toggle {
    margin-left: auto;
  }

  .card {
    padding: var(--space-5) var(--space-5);
  }

  .hero .container {
    gap: var(--space-6);
  }

  .hero-visual {
    order: -1;
    width: 100%;
  }

  .name-to-mark {
    height: 2.6em;
  }
}
