/* Shared styles for all pages.
   Colours: a light mode can be added later by overriding these
   under :root[data-theme="light"]. */
:root {
  color-scheme: dark;
  --bg: #0c0c0d;
  --surface: #141416;
  --line: #252527;
  --text: #ededeb;
  --body: #cfccc6;
  --muted: #8f8d88;
  --accent: #ffb000;
  --accent-soft: rgba(255, 176, 0, 0.12);
  --accent-pulse: rgba(255, 176, 0, 0.6);
  --accent-clear: rgba(255, 176, 0, 0);
  --on-accent: #0c0c0d; /* text on filled accent buttons */
  --grid: rgba(255, 255, 255, 0.045);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
section, #top { scroll-margin-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Faint dot grid in the background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(var(--grid) 1px, transparent 1px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 90%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 90%);
  pointer-events: none;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* Language switch: every text has an English and a Finnish version,
   marked lang="en" / lang="fi". Only the active one is shown. */
html[data-lang="fi"] body [lang="en"],
html[data-lang="en"] body [lang="fi"] { display: none !important; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
a:hover { border-bottom-color: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 12, 13, 0.78);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.brand::before { content: ">"; color: var(--accent); margin-right: 8px; }
/* Console-style cursor after the name */
.brand::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.18em;
  background: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .brand::after { animation: blink 1.1s steps(1) infinite; }
}
.nav-links {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.topbar .brand,
.topbar .nav-links a { border-bottom: 0; }
.nav-links a {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }
.nav-cta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 6px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.nav-cta:hover,
.nav-cta.active { background: var(--accent); color: var(--on-accent); }
.topbar .short { display: none; }
.lang-switch {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.lang-switch:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Page layout ---------- */
main {
  max-width: 700px;
  margin: 0 auto;
  padding: 104px 20px 64px;
}

/* Pulsing ring for the "live" dots */
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-pulse), 0 0 10px var(--accent); }
  70%  { box-shadow: 0 0 0 9px var(--accent-clear), 0 0 10px var(--accent); }
  100% { box-shadow: 0 0 0 0 var(--accent-clear), 0 0 10px var(--accent); }
}
@media (prefers-reduced-motion: no-preference) {
  .eyebrow::before,
  .job.current::after { animation: pulse 2s ease-out infinite; }
}

/* Header */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
h1 {
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 18px;
}
.headline {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 80px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}
.headline > span { white-space: nowrap; }
.headline > span:not(:last-child)::after {
  content: "/";
  color: var(--accent);
  margin: 0 10px;
}

/* Section headings */
section + section { margin-top: 72px; }
h2 {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
h2 .idx { color: var(--accent); }
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.about p { margin: 0 0 14px; color: var(--body); }
.about p:last-child { margin-bottom: 0; }

/* ---------- Experience timeline ---------- */
.timeline { position: relative; }
.job {
  position: relative;
  padding: 0 0 36px 30px;
}
.job:last-child { padding-bottom: 0; }
.job::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: -6px;
  width: 1px;
  background: var(--line);
}
.job:last-child::before { display: none; }
.job::after {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--muted);
}
.job.current::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px var(--accent);
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 16px;
}
.title { font-weight: 600; font-size: 1.05rem; margin: 0; }
.dates {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.company { color: var(--accent); margin: 2px 0 10px; font-size: 0.95rem; }
.job p, .entry p { margin: 0; color: var(--body); }

.tags {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags li {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 8px;
  transition: color .15s, border-color .15s;
}
.tags li:hover { color: var(--accent); border-color: var(--accent); }
.job.current .tags li { color: var(--text); }

/* ---------- Education ---------- */
.entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 22px;
}

/* ---------- Certifications ---------- */
.certs {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.certs li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 22px;
  font-size: 0.95rem;
}
.certs li + li { border-top: 1px solid var(--line); }
.certs em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 8px;
  white-space: nowrap;
}

/* ---------- Languages & licence ---------- */
.langs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.langs li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.langs .name { font-weight: 600; }
.langs .level {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- 404 page ---------- */
.console {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.9;
  margin: 8px 0 32px;
  overflow: hidden;
}
.console-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}
.console-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line);
}
.console-bar span { margin-left: 8px; }
.console-body { padding: 18px 20px; overflow-x: auto; }
.console-body div { white-space: pre-wrap; word-break: break-all; }
.console .dim { color: var(--muted); }
.console .err { color: var(--accent); }
.console .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: -0.18em;
  background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .console .cursor { animation: blink 1.1s steps(1) infinite; }
}

/* ---------- Contact page ---------- */
.lead {
  color: var(--body);
  margin: 0 0 48px;
  max-width: 540px;
}
.email-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.email-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.email-card a.email {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 4.6vw, 1.6rem);
  font-weight: 500;
  color: var(--text);
  border-bottom: 0;
  overflow-wrap: anywhere;
  transition: color .15s;
}
.email-card a.email:hover { color: var(--accent); }
.email-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.copy-btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 18px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-status {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.copy-status:empty { display: none; }
.copy-status::before { content: "> "; }
.btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 11px 22px;
  cursor: pointer;
  transition: filter .15s, box-shadow .15s;
}
a.btn { display: inline-block; }
.btn:hover { filter: brightness(1.08); box-shadow: 0 0 16px var(--accent-soft); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Footer ---------- */
footer {
  margin-top: 88px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .brand { display: none; }
  .topbar-inner { gap: 8px; padding: 0 12px; }
  .nav-links { margin-left: 0; flex: 1; }
  .nav-links a { padding: 6px 7px; }
  .topbar .long { display: none; }
  .topbar .short { display: inline; }
  .nav-cta { padding: 6px 10px; }
  .lang-switch { padding: 6px 7px; }
  .langs { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  main { padding-top: 48px; }
  .headline { margin-bottom: 56px; }
  .headline > span { width: 100%; white-space: normal; }
  .headline > span:not(:last-child)::after { content: none; }
  .headline > span::before { content: "›"; color: var(--accent); margin-right: 8px; }
  .certs li { padding: 12px 16px; flex-direction: column; gap: 2px; }
  .entry { padding: 18px 16px; }
  .email-card { padding: 20px 16px; }
}
