/* Rantalainen Sports Science Consulting: site stylesheet */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2efe8;
  --text: #1c1d1f;
  --text-muted: #5b5e63;
  --border: #e3dfd6;
  --accent: #d9620a;          /* disc orange */
  --accent-strong: #b34f05;
  --accent-soft: #fbe9d9;
  --accent-2: #1f8a43;        /* flight-plate green */
  --code-bg: #f2efe8;
  --shadow: 0 1px 2px rgba(28, 29, 31, 0.05), 0 4px 16px rgba(28, 29, 31, 0.05);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --max-width: 68rem;
  --gutter: 1.25rem;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1b1c1f;
    --surface-2: #232428;
    --text: #e9e8e4;
    --text-muted: #a3a49f;
    --border: #2e3034;
    --accent: #f2873a;
    --accent-strong: #ffa260;
    --accent-soft: #3a2614;
    --accent-2: #4cc27a;
    --code-bg: #232428;
    --shadow: none;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); font-weight: 650; margin-top: 2.2em; }
h3 { font-size: 1.15rem; font-weight: 650; }

p { margin: 0 0 1em; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

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

/* ---------- Header and navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
}

.brand small {
  display: block;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0;
}

.site-nav ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 550;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-nav a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(3rem, 9vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  margin-bottom: 1rem;
}

.lede {
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 44rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-block;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.button.secondary {
  background: transparent;
  color: var(--accent-strong);
}

.button.secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---------- Cards and grids ---------- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 0.4em;
}

.card p:last-child {
  margin-bottom: 0;
}

.card .card-link {
  font-weight: 600;
  text-decoration: none;
}

.card .card-link::after {
  content: " →";
}

.stat-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  margin: 1.5rem 0;
}

.stat {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0 0.2rem 0.9rem;
}

.stat strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---------- Project pages ---------- */

.project {
  display: grid;
  gap: 1.5rem 2rem;
  grid-template-columns: minmax(0, 1fr);
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.project:first-of-type {
  border-top: 0;
}

@media (min-width: 52rem) {
  .project {
    grid-template-columns: 7rem minmax(0, 1fr);
  }
}

.project-icon {
  width: 6rem;
  height: 6rem;
  border-radius: 22%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.project-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project h2 {
  margin-top: 0;
}

.project .subtitle {
  color: var(--text-muted);
  margin-top: -0.4em;
}

.project h3 {
  margin-top: 1.5em;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pipeline {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0 0 1rem;
}

.pipeline li {
  counter-increment: step;
  position: relative;
  padding: 0.55rem 0 0.55rem 2.6rem;
  border-left: 2px solid var(--border);
  margin-left: 0.9rem;
}

.pipeline li::before {
  content: counter(step);
  position: absolute;
  left: -0.95rem;
  top: 0.55rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.pipeline li:last-child {
  border-left-color: transparent;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.link-list a {
  font-weight: 600;
}

.callout {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.video {
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: #000;
  display: block;
}

.download {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.download img {
  width: 5.5rem;
  height: 5.5rem;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- CV ---------- */

.cv-section {
  margin-top: 2.5rem;
}

.cv-section > h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin: 0 0 1rem;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem 1.5rem;
  padding: 0.7rem 0;
}

@media (min-width: 40rem) {
  .timeline li {
    grid-template-columns: 8.5rem 1fr;
  }
}

.timeline .when {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0.15rem;
}

.timeline .what strong {
  display: block;
}

.timeline .what span {
  color: var(--text-muted);
}

.timeline .what p {
  margin: 0.3rem 0 0;
}

.skills {
  display: grid;
  gap: 1rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.skills h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.skills p {
  color: var(--text-muted);
  margin: 0;
}

.plain-list {
  padding-left: 1.2rem;
  margin: 0;
}

.plain-list li {
  margin-bottom: 0.45rem;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

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

/* ---------- Print (the CV page prints cleanly) ---------- */

@media print {
  :root {
    --bg: #fff;
    --text: #000;
    --text-muted: #333;
    --border: #ccc;
  }

  .site-header,
  .site-footer,
  .no-print {
    display: none;
  }

  body {
    font-size: 10.5pt;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .cv-section {
    break-inside: avoid-page;
  }
}
