/* Komee ja hyvä – v2. Liquid Glass taustakuvan päällä, iOS 26 -kotinäytön tapaan.
   Väri tulee kuvasta; käyttöliittymä on pelkkää valkoista tekstiä ja lasia. */

:root {
  color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --label: #fff;
  --label-2: rgba(255, 255, 255, 0.84);
  --label-3: rgba(255, 255, 255, 0.7);
  --r-widget: 34px;
  --r-icon: 22px;
  --pad: 22px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --glass-fill: rgba(22, 24, 38, 0.30);
  --glass-backdrop: blur(26px) saturate(185%) brightness(0.62);
  --glass-backdrop-refract: saturate(185%) brightness(0.62);
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: #0b0d18; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.42;
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  background: transparent;
}

h1, h2, p { margin: 0; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Taustakuva (alusta lasille) ---------- */

.wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0b0d18;
}

.wall__img {
  position: absolute;
  inset: -4%;
  background-image: image-set(url("assets/bg-desk.webp") type("image/webp"), url("assets/bg-desk.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: 50% 40%;
  transform: translate3d(var(--px, 0), var(--py, 0), 0) scale(1.02);
  will-change: transform;
}

@media (max-aspect-ratio: 1/1) {
  .wall__img {
    background-image: image-set(url("assets/bg-phone.webp") type("image/webp"), url("assets/bg-phone.jpg") type("image/jpeg"));
    background-position: 50% 30%;
  }
}

/* Tummennus ylä- ja alareunaan: nimi ja dock pysyvät luettavina. */
.wall::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 6, 14, 0.55) 0%, rgba(5, 6, 14, 0.12) 26%, rgba(5, 6, 14, 0.05) 50%, rgba(5, 6, 14, 0.45) 100%);
}

/* ---------- Asettelu ---------- */

.home {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 64px) 18px calc(140px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.hero { padding: 0 6px; }

.hero__brand {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--label-2);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
}

.hero__name {
  margin-top: 4px;
  font-family: var(--font);
  font-size: clamp(66px, 20vw, 152px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.045em;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
}

.hero__role {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--label);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.6);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- Lasi ---------- */

.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-backdrop);
  backdrop-filter: var(--glass-backdrop);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 1px 0 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 24px rgba(255, 255, 255, 0.05),
    0 10px 34px rgba(0, 0, 0, 0.30),
    0 2px 6px rgba(0, 0, 0, 0.16);
  transition: transform 420ms var(--ease-spring), box-shadow 300ms ease;
}

/* Chromium: oikea linssitaitto. glass.js lisää --lg-filter-arvon ja .lg-refract-luokan. */
.lg-refract .glass[data-refract] {
  -webkit-backdrop-filter: var(--lg-filter) var(--glass-backdrop-refract);
  backdrop-filter: var(--lg-filter) var(--glass-backdrop-refract);
}

/* Valoa heijastava reuna: kirkas ylhäällä vasemmalla, himmenee alas oikealle. */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.2px;
  background: linear-gradient(140deg,
    rgba(255, 255, 255, 0.75) 0%,
    rgba(255, 255, 255, 0.18) 28%,
    rgba(255, 255, 255, 0.04) 55%,
    rgba(255, 255, 255, 0.16) 82%,
    rgba(255, 255, 255, 0.4) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  z-index: 2;
}

/* Kiilto, joka seuraa sormea/osoitinta. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 70% at var(--mx, 28%) var(--my, -10%), rgba(255, 255, 255, 0.16), transparent 60%);
  pointer-events: none;
  z-index: -1;
  transition: opacity 300ms ease;
}

/* ---------- Widgetit ---------- */

.widget {
  border-radius: var(--r-widget);
  padding: var(--pad) calc(var(--pad) + 2px) calc(var(--pad) + 2px);
}

.widget__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--label-3);
  margin-bottom: 8px;
}

.widget__text {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--label);
  text-wrap: pretty;
}

.bill__name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.bill__line {
  margin-top: 4px;
  font-size: 19px;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}

.bill__mail {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Napit lasin sisällä ovat täyttöjä, eivät uutta lasia (ei lasia lasin päälle). */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font: 600 18px/1 var(--font);
  letter-spacing: -0.01em;
  color: var(--label);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: transform 380ms var(--ease-spring), background 200ms ease;
}

.pill svg { width: 22px; height: 22px; flex: none; }

.pill--primary {
  background: rgba(255, 255, 255, 0.92);
  color: #0b0d18;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.pill:hover { background: rgba(255, 255, 255, 0.22); }
.pill--primary:hover { background: #fff; }
.pill:active { transform: scale(0.95); }

/* ---------- App-ikonit ---------- */

.apps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 2px 0;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 20px;
  outline-offset: 6px;
}

.app__icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: var(--r-icon);
  color: #fff;
}

.app__icon svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.25));
}

.app__label {
  margin-top: 10px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  hyphens: manual;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7), 0 0 2px rgba(0, 0, 0, 0.4);
}

.app__domain {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 500;
  color: var(--label-2);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7), 0 0 2px rgba(0, 0, 0, 0.4);
}

/* "Jelly": painettaessa lasi painuu ja palaa jousella. */
.app:hover .app__icon { transform: translateY(-3px) scale(1.04); }
.app:active .app__icon,
.app.is-pressed .app__icon { transform: scale(0.9, 0.86); transition-duration: 120ms; }

/* ---------- Dock ---------- */

.dock {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px 9px 9px;
  border-radius: 999px;
}

.dock__btn {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 380ms var(--ease-spring), background 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.dock__btn svg { width: 27px; height: 27px; }
.dock__btn:hover { background: rgba(255, 255, 255, 0.22); }
.dock__btn:active,
.dock__btn.is-pressed { transform: scale(0.86); transition-duration: 120ms; }

.dock__sep {
  width: 1px;
  height: 30px;
  margin: 0 8px 0 10px;
  background: rgba(255, 255, 255, 0.28);
}

.dock__handle {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Fokus ---------- */

a:focus-visible, button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px rgba(0, 0, 0, 0.55);
}
.app:focus-visible { outline: none; box-shadow: none; }
.app:focus-visible .app__icon { outline: 3px solid #fff; outline-offset: 4px; }

/* ---------- Kone: nimi vasemmalle, widgetit oikealle ---------- */

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .home {
    width: min(100%, 1320px);
    min-height: 100svh;
    padding: 72px 64px 150px;
    display: grid;
    grid-template-columns: 1fr minmax(400px, 460px);
    align-items: center;
    gap: 64px;
  }
  .hero { align-self: end; padding-bottom: 10px; }
  .hero__name { font-size: clamp(96px, 10.5vw, 168px); }
  .hero__brand { font-size: 22px; }
  .hero__role { font-size: 22px; }
  .stack { gap: 20px; }
}

/* ---------- Saavutettavuus ---------- */

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .lg-refract .glass[data-refract] {
    background: rgba(20, 22, 34, 0.94);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .glass::before { display: none; }
}

@media (prefers-contrast: more) {
  .glass { background: rgba(10, 10, 16, 0.92); }
  .glass::after { background: rgba(255, 255, 255, 0.85); }
  :root { --label-2: #fff; --label-3: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; }
  .wall__img { transform: none; }
  .app:hover .app__icon, .app:active .app__icon, .app.is-pressed .app__icon,
  .dock__btn:active, .dock__btn.is-pressed, .pill:active { transform: none; }
}
