/* Layout: yksi tumma "yötaivas"-maailma. Hero = tähtikenttä + revontulikaista + live-mittauskäyrä; muu sivu rauhallinen, vasemmalle tasattu. */
:root {
  --space: #0a0e1f;      /* tausta: syvä yönsininen */
  --nebula: #121935;     /* nostetut pinnat */
  --line: #26305a;       /* viivat ja reunat */
  --ink: #e7eaf6;        /* teksti */
  --muted: #959ec4;      /* toissijainen teksti */
  --aurora: #5ce6c9;     /* pääaksentti: revontuli */
  --signal: #f3b55c;     /* mittausarvot ja live-data */
  --ok: #5ce6a0;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(2rem, 4vw, 2.75rem);
  --step-4: clamp(2.6rem, 7vw, 5.2rem);

  --radius: 14px;
  --maxw: 1160px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--space);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--space);
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--aurora); outline-offset: 3px; border-radius: 4px; }

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* Wordmark */
.wordmark { font-family: var(--f-display); font-size: 1.45rem; text-decoration: none; letter-spacing: -0.02em; line-height: 1; }
.wm-meter { font-weight: 400; color: var(--ink); }
.wm-iot { font-weight: 800; color: var(--aurora); }
.wordmark--small { font-size: 1.15rem; }

/* Nav */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  transition: background-color .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-solid { background: color-mix(in srgb, var(--space) 88%, transparent); backdrop-filter: blur(10px); border-bottom-color: var(--line); }
.nav__inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 16px max(20px, env(safe-area-inset-right, 0px)) 16px max(20px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 24px;
}
.nav__links { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.nav__links a { text-decoration: none; color: var(--muted); font-size: var(--step--1); font-weight: 500; transition: color .2s; }
.nav__links a:hover { color: var(--ink); }
.nav__links .nav__cta { color: var(--space); background: var(--aurora); padding: 8px 16px; border-radius: 999px; }
.nav__links .nav__cta:hover { color: var(--space); background: color-mix(in srgb, var(--aurora) 85%, white); }
.nav__toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--ink); font: 500 var(--step--1) var(--f-body); padding: 8px 14px; border-radius: 999px; cursor: pointer; }

@media (max-width: 760px) {
  .nav__toggle { display: inline-block; }
  .nav__links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: flex-start; gap: 4px;
    background: var(--nebula); border-bottom: 1px solid var(--line);
    padding: 12px max(20px, env(safe-area-inset-right, 0px)) 20px max(20px, env(safe-area-inset-left, 0px));
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { font-size: var(--step-0); padding: 8px 0; }
  .nav__links .nav__cta { margin-top: 8px; padding: 10px 18px; }
}

/* Hero */
.hero { position: relative; overflow: hidden; margin-top: -70px; padding-top: 70px; isolation: isolate; }
.hero__stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero__aurora {
  position: absolute; z-index: -1; left: -20%; right: -20%; top: -10%; height: 70%;
  background:
    radial-gradient(60% 50% at 30% 60%, color-mix(in srgb, var(--aurora) 26%, transparent), transparent 70%),
    radial-gradient(40% 40% at 70% 40%, color-mix(in srgb, #7b6cf0 22%, transparent), transparent 70%);
  filter: blur(30px);
  transform-origin: 50% 0;
  animation: aurora-drift 18s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes aurora-drift {
  from { translate: -3% 0; scale: 1 1; }
  to { translate: 3% 2%; scale: 1.08 1.15; }
}
.hero__content { padding-block: clamp(72px, 12vw, 150px) 40px; }
.hero__kicker { color: var(--aurora); font-weight: 500; margin: 0 0 18px; font-size: var(--step--1); letter-spacing: 0.02em; }
.hero__title {
  font-family: var(--f-display); font-weight: 800; font-size: var(--step-4);
  line-height: 0.98; letter-spacing: -0.035em; margin: 0; max-width: 14ch; text-wrap: balance;
}
.hero__lead { color: var(--muted); font-size: var(--step-1); max-width: 52ch; margin: 28px 0 0; line-height: 1.5; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 var(--step-0) var(--f-body); text-decoration: none;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--aurora); color: var(--space); }
.btn--primary:hover { background: color-mix(in srgb, var(--aurora) 85%, white); }
.btn--ghost { color: var(--ink); border-color: var(--line); background: color-mix(in srgb, var(--nebula) 60%, transparent); }
.btn--ghost:hover { border-color: var(--muted); }

/* Scope: live-mittauskäyrä */
.scope { position: relative; border-top: 1px solid var(--line); background: linear-gradient(to bottom, color-mix(in srgb, var(--space) 20%, transparent), var(--space)); }
.scope__trace { display: block; width: 100%; height: 120px; }
.scope__readouts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
  margin-block: 0; padding-block: 0 28px;
}
.readout { border-left: 2px solid var(--line); padding-left: 14px; }
.readout dt { color: var(--muted); font-size: var(--step--1); }
.readout dd { margin: 2px 0 0; font-family: var(--f-data); font-size: var(--step-1); color: var(--signal); font-variant-numeric: tabular-nums; }
.readout--status dd { color: var(--ok); display: flex; align-items: center; gap: 8px; font-size: var(--step-0); padding-top: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
@media (max-width: 760px) { .scope__readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; } }

/* Sections */
.section { padding-block: clamp(72px, 10vw, 128px); }
.section__title { font-family: var(--f-display); font-weight: 800; font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 40px; text-wrap: balance; }

.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.service { padding: 32px 32px 8px 0; min-width: 0; }
.service + .service { padding-left: 32px; border-left: 1px solid var(--line); }
.service h3 { font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); letter-spacing: -0.02em; margin: 0 0 12px; }
.service p { color: var(--muted); margin: 0 0 20px; max-width: 40ch; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-size: var(--step--1); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; }
@media (max-width: 860px) {
  .services { grid-template-columns: 1fr; }
  .service, .service + .service { padding: 28px 0; border-left: 0; }
  .service + .service { border-top: 1px solid var(--line); }
}

/* Telinekortti */
.section--product { background: linear-gradient(180deg, var(--space), var(--nebula) 40%, var(--space)); }
.product { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.product__text p { color: var(--muted); max-width: 54ch; }
.product__text .section__title { margin-bottom: 20px; }
.badge { display: inline-block; color: var(--signal) !important; border: 1px solid color-mix(in srgb, var(--signal) 45%, transparent); border-radius: 999px; padding: 2px 12px; font-size: var(--step--1); margin: 0 0 18px; }
.checks { list-style: none; padding: 0; margin: 24px 0 32px; display: grid; gap: 10px; }
.checks li { padding-left: 28px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 2px; top: 0.55em; width: 12px; height: 6px; border-left: 2px solid var(--aurora); border-bottom: 2px solid var(--aurora); transform: rotate(-45deg); }

.waitlist label, .contact__form label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.waitlist__row { display: flex; gap: 10px; flex-wrap: wrap; }
.waitlist__row input { flex: 1 1 220px; }
input, textarea {
  width: 100%; font: var(--step-0) var(--f-body); color: var(--ink);
  background: var(--space); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  transition: border-color .2s;
}
input:focus, textarea:focus { outline: none; border-color: var(--aurora); }
textarea { resize: vertical; min-height: 120px; }
.form__msg { min-height: 1.6em; margin: 10px 0 0; font-size: var(--step--1); color: var(--muted) !important; }
.form__msg.is-ok { color: var(--ok) !important; }
.form__msg.is-error { color: var(--signal) !important; }

.tag-card {
  background: var(--space); border: 1px solid var(--line); border-radius: 18px; padding: 24px;
  box-shadow: 0 30px 80px -30px color-mix(in srgb, var(--aurora) 30%, transparent);
  transform: rotate(1.5deg);
}
.tag-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tag-card__id { font-family: var(--f-data); color: var(--muted); font-size: var(--step--1); }
.pill { font-size: var(--step--1); font-weight: 600; padding: 3px 12px; border-radius: 999px; }
.pill--ok { color: var(--space); background: var(--ok); }
.tag-card__name { font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); letter-spacing: -0.02em; margin: 14px 0 18px; line-height: 1.15; }
.tag-card__meta { margin: 0; display: grid; gap: 10px; }
.tag-card__meta div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.tag-card__meta dt { color: var(--muted); font-size: var(--step--1); }
.tag-card__meta dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.tag-card__foot { display: flex; gap: 16px; align-items: center; margin-top: 20px; }
.tag-card__foot p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.qr { flex: none; width: 84px; height: 84px; border-radius: 8px; background: var(--ink); }
@media (max-width: 860px) { .product { grid-template-columns: 1fr; } .tag-card { transform: none; } }

/* Referenssit */
.refs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; }
.ref { border-top: 1px solid var(--line); padding: 28px 0 36px; min-width: 0; }
.ref__meta { color: var(--aurora); font-size: var(--step--1); margin: 0 0 8px; }
.ref h3 { font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); letter-spacing: -0.02em; margin: 0 0 10px; }
.ref p:not(.ref__meta) { color: var(--muted); margin: 0 0 14px; max-width: 52ch; }
.ref__link { color: var(--ink); text-decoration-color: var(--aurora); text-underline-offset: 4px; font-weight: 500; }
@media (max-width: 760px) { .refs { grid-template-columns: 1fr; } }

/* Meistä */
.about { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: clamp(32px, 6vw, 80px); }
.about__text p { color: var(--muted); max-width: 58ch; }
.people { display: flex; flex-wrap: wrap; gap: 40px; margin-top: 32px; }
.person__name { font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); margin: 0; color: var(--ink) !important; }
.person__role { margin: 2px 0 0; font-size: var(--step--1); }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; display: grid; gap: 22px; align-self: center; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--aurora), var(--line)); }
.timeline li { position: relative; padding-left: 30px; display: grid; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--space); border: 2px solid var(--aurora); }
.timeline__year { font-family: var(--f-data); color: var(--signal); font-size: var(--step--1); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* Yhteys */
.section--contact { border-top: 1px solid var(--line); }
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.contact p { color: var(--muted); max-width: 46ch; }
.contact__direct { color: var(--ink) !important; }
.selectable { user-select: all; color: var(--aurora); }
.contact__form { display: grid; gap: 6px; }
.contact__form label { margin: 10px 0 2px; }
.contact__form .btn { justify-self: start; margin-top: 16px; }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: var(--step--1); }
.footer__inner { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; }
.footer__inner > :last-child { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__aurora, .dot { animation: none; }
}

/* Lomakkeiden tietosuojahuomautus */
.form__note { margin: 4px 0 0; font-size: var(--step--1); color: var(--muted) !important; }
.form__note a, .footer a { color: inherit; text-underline-offset: 3px; }
.footer a:hover, .form__note a:hover { color: var(--ink); }

/* Tekstisivut (tietosuoja ym.) */
.legal { padding-block: clamp(48px, 8vw, 96px); }
.legal__body { max-width: 68ch; }
.legal__body h1 { font-family: var(--f-display); font-weight: 800; font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 12px; }
.legal__body h2 { font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); letter-spacing: -0.01em; margin: 40px 0 8px; }
.legal__body p, .legal__body li { color: var(--muted); }
.legal__body strong { color: var(--ink); font-weight: 600; }
.legal__body ul { padding-left: 1.2em; }
.legal__body a { color: var(--aurora); text-underline-offset: 3px; }
.legal__meta { font-size: var(--step--1); }
.legal__table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: var(--step--1); }
.legal__table th, .legal__table td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.legal__table th { color: var(--ink); font-weight: 600; }
.legal__table td { color: var(--muted); }
.table-scroll { overflow-x: auto; }
.nav__links--static, .nav__links--static.is-open { display: flex; position: static; flex-direction: row; align-items: center; gap: 20px; background: none; border: 0; padding: 0; }
.nav__links--static a { padding: 0; }
.nav__links--static .nav__cta { margin-top: 0; }
