/* ---------- Värit ---------- */
:root {
  --bg: #eef1f8;
  --text: #11131a;
  --muted: #4a5163;
  --accent: #2f6fed;

  --blob-1: #7aa8ff;
  --blob-2: #ff9ad5;
  --blob-3: #8ef0d0;

  /* Lasi */
  --glass-bg: rgba(255, 255, 255, 0.38);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 10px 40px rgba(30, 40, 80, 0.12);
  --glass-sheen: rgba(255, 255, 255, 0.55);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d14;
    --text: #eef0f6;
    --muted: #a3aabd;
    --accent: #a9c4ff;

    --blob-1: #2a44c8;
    --blob-2: #b03a8c;
    --blob-3: #138a74;

    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.16);
    --glass-edge: rgba(255, 255, 255, 0.28);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    --glass-sheen: rgba(255, 255, 255, 0.14);
  }
}

/* ---------- Perusta ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

main { flex: 1; }

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Tausta: liikkuvat värilaikut ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.75;
  animation: drift 26s ease-in-out infinite alternate;
}
.blob--1 { background: var(--blob-1); top: -20vmax; left: -15vmax; }
.blob--2 { background: var(--blob-2); top: 10vmax; right: -25vmax; animation-delay: -8s; animation-duration: 32s; }
.blob--3 { background: var(--blob-3); bottom: -30vmax; left: 15vmax; animation-delay: -16s; animation-duration: 38s; }

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vmax, 4vmax) scale(1.08); }
  100% { transform: translate(-4vmax, 7vmax) scale(0.95); }
}

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

/* ---------- Liquid glass ---------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  isolation: isolate;
}
/* Kiiltoheijastus lasin yläreunassa */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, var(--glass-sheen) 0%, transparent 45%);
  pointer-events: none;
  z-index: -1;
}

/* Selaimet ilman backdrop-filteriä: hieman peittävämpi lasi */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: color-mix(in srgb, var(--bg) 85%, transparent); }
}

/* ---------- Yläpalkki ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: 16px;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-radius: 999px;
}
.logo {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span, h1 span { color: var(--accent); }
/* Otsikon "dev" liukuvärinä, jotta se erottuu taustasta molemmissa teemoissa */
h1 span {
  background: linear-gradient(100deg, var(--accent), #c56cf0 60%, #ff7eb3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (prefers-color-scheme: dark) {
  .blob { opacity: 0.55; }
  h1 span { background-image: linear-gradient(100deg, #b9d0ff, #e3a8ff 60%, #ffb3d1); }
}
nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
nav a:hover { color: var(--text); background: var(--glass-bg); }
nav { display: flex; align-items: center; gap: 6px; }

/* Kielivalitsin */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.lang-switch a {
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lang-switch a[aria-current="true"] {
  background: var(--accent);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .lang-switch a[aria-current="true"] { color: #0b0d14; }
}

/* ---------- Hero ---------- */
.hero { padding-top: 72px; padding-bottom: 56px; }
.hero-panel {
  padding: 48px 40px;
  border-radius: 32px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.75rem, 9vw, 5rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
}
.lead {
  margin: 14px 0 0;
  font-size: 1.2rem;
  color: var(--muted);
}

/* ---------- Projektit ---------- */
.projects { padding-bottom: 96px; scroll-margin-top: 96px; }
.projects h2 {
  font-size: 1.4rem;
  margin: 0 0 20px 4px;
  letter-spacing: -0.02em;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
.card {
  display: block;
  padding: 22px;
  border-radius: 22px;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
a.card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    0 18px 50px rgba(30, 40, 80, 0.18),
    inset 0 1px 0 var(--glass-edge);
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card--empty { border-style: dashed; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.card-head h3 { margin: 0; }
.tag {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.tag--private::before { content: "🔒 "; }
.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}
.stack li {
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--glass-border);
}
.card .card-note { margin-top: 12px; font-size: 0.85rem; font-style: italic; }

/* ---------- Alapalkki ---------- */
.site-footer {
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Keskitetty hero + rakenteilla-merkki ---------- */
.hero--center {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 40px;
  padding-bottom: 40px;
}
.hero--center .hero-panel {
  width: 100%;
  max-width: 640px;
  text-align: center;
  padding: 56px 40px;
}
.hero--center .lead { max-width: 32ch; margin-left: auto; margin-right: auto; }
.sublead { margin: 12px 0 0; font-size: 0.9rem; color: var(--muted); opacity: 0.8; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5a524;
  box-shadow: 0 0 0 0 rgba(245, 165, 36, 0.6);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 165, 36, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(245, 165, 36, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
}

/* ---------- Alapalkin linkit ---------- */
.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a, .link-button {
  color: var(--muted);
  text-decoration: none;
  font: inherit;
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.footer-links a:hover, .link-button:hover { color: var(--text); text-decoration: underline; }

/* ---------- Painikkeet ---------- */
.btn {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  transition: transform 0.15s, background 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .btn--primary { color: #0b0d14; }
}
.btn:focus-visible, .link-button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Evästebanneri ---------- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 22px;
  border-radius: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  justify-content: space-between;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; flex: 1 1 320px; font-size: 0.95rem; }
.cookie-banner p a { color: var(--accent); }
.cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Tekstisivut (tietosuoja) ---------- */
.prose-wrap { padding-top: 48px; padding-bottom: 72px; }
.prose {
  padding: 40px;
  border-radius: 28px;
  max-width: 760px;
  margin: 0 auto;
}
.prose h1 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.prose .updated { margin: 0 0 28px; color: var(--muted); font-size: 0.9rem; }
.prose h2 { font-size: 1.15rem; margin: 32px 0 8px; letter-spacing: -0.01em; }
.prose p, .prose li { color: var(--text); }
.prose ul { padding-left: 22px; }
.prose a { color: var(--accent); }
.prose code {
  font-size: 0.9em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

/* ---------- Tietoa-sivu ---------- */
.timeline {
  list-style: none;
  padding: 0 0 0 18px;
  margin: 12px 0 0;
  border-left: 2px solid var(--glass-border);
}
.timeline li {
  position: relative;
  padding: 0 0 18px 14px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--glass-bg);
}
.timeline strong { display: block; }
.timeline span { color: var(--muted); }
.prose .stack { padding-left: 0; }
.stack--lg li { font-size: 0.85rem; padding: 4px 12px; }
nav a[aria-current="page"] { color: var(--text); background: var(--glass-bg); }

/* ---------- Mobiili ---------- */
@media (max-width: 600px) {
  .hero { padding-top: 40px; padding-bottom: 40px; }
  .hero-panel { padding: 32px 24px; border-radius: 26px; }
  .nav { padding: 0 8px 0 18px; }
  .hero--center { min-height: calc(100vh - 140px); }
  .hero--center .hero-panel { padding: 40px 22px; }
  .prose { padding: 28px 20px; border-radius: 22px; }
  .cookie-actions { width: 100%; }
  .cookie-actions .btn { flex: 1; }
}
