/* ==========================================================================
   Oldground Software Oy — styles
   Typographic, grid-based layout. Hairlines instead of boxes, one accent.

   Colour themes are scoped to a class, so any section (or the whole page)
   can be flipped by changing one class: .theme-dark / .theme-paper
   ========================================================================== */

/* Archivo, served from our own server (no requests to Google).
   One variable file covers every weight (100-900) and width (62-125%). */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../assets/fonts/archivo-latin.woff2") format("woff2");
}

:root {
  /* Type */
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --wide: 112%;              /* font-stretch for headings, echoes the logo */
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-h1: clamp(2.25rem, 0.2rem + 5.4vw, 4.75rem);
  --fs-h2: clamp(2rem, 1.3rem + 2.4vw, 3.4rem);
  --fs-h3: clamp(1.45rem, 1.1rem + 1.2vw, 2.1rem);

  /* Layout */
  --container: 1280px;
  --pad-x: clamp(1.25rem, 0.5rem + 3vw, 3rem);
  --gap: clamp(1.5rem, 0.75rem + 3vw, 4rem);
  --label-col: calc((100% - var(--gap)) / 4);
  --section-y: clamp(5rem, 3.5rem + 6vw, 9rem);
  --header-h: 76px;

  /* Brand (from the logo) */
  --brand: #36a9e1;
  --brand-deep: #1d71b8;
}

.theme-dark {
  --bg: #0e0f11;
  --bg-raise: #16171a;
  --fg: #eceae4;
  --muted: #9d9a93;
  --line: rgba(236, 234, 228, 0.12);
  --line-strong: rgba(236, 234, 228, 0.26);
  --accent: var(--brand);
  --accent-ink: #0e0f11;
  --error: #ff8a80;
}

.theme-paper {
  --bg: #ecebe6;
  --bg-raise: #e2e0da;
  --fg: #111214;
  --muted: #55534d;
  --line: rgba(17, 18, 20, 0.14);
  --line-strong: rgba(17, 18, 20, 0.4);
  --accent: var(--brand-deep);
  --accent-ink: #ffffff;
  --error: #b3261e;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  font-stretch: var(--wide);
  letter-spacing: -0.02em;
  line-height: 1.05;
  overflow-wrap: break-word; /* safety net for long Finnish compounds */
}
p { margin: 0; text-wrap: pretty; }
.service__text { text-wrap: wrap; } /* "pretty" breaks these short paragraphs unevenly */
h1, h2, h3, .statement { text-wrap: balance; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--brand); color: #0e0f11; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Grid ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

/* Two-column page grid: narrow label column + wide body column */
.layout {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  column-gap: var(--gap);
}
.col-label { grid-column: 1; }
.col-body { grid-column: 2; }

/* ---------- Sections ---------- */
.section {
  padding-block: var(--section-y);
  background: var(--bg);
  color: var(--fg);
  border-top: 1px solid var(--line);
}

.sec-head { margin-bottom: clamp(3rem, 2rem + 4vw, 5.5rem); }
.sec-label {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
  padding-top: 0.55em;
}
.sec-head h2,
.contact h2 { font-size: var(--fs-h2); max-width: 18ch; }
.sec-intro {
  margin-top: 1.5rem;
  max-width: 40rem;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1rem 1.5rem;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.btn:hover svg { transform: translateX(3px); }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--fg); color: var(--bg); }

.btn--sm { padding: 0.7rem 1.1rem; }

.btn--text {
  padding-inline: 0;
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.4em;
}
.btn--text:hover { color: var(--accent); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled,
.site-header.is-open { border-bottom-color: var(--line); }

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.logo img { height: 44px; width: auto; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav__links a:not(.btn) {
  position: relative;
  padding-block: 0.4rem;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav__links a:not(.btn):hover,
.nav__links a.is-active { color: var(--fg); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
}

.nav__actions { display: flex; align-items: center; gap: 1.25rem; }

/* Language switch: EN | FI */
.lang { display: flex; align-items: center; }
.lang__btn {
  position: relative;
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: color 0.15s ease;
}
.lang__btn + .lang__btn { border-left: 1px solid var(--line-strong); }
.lang__btn:hover { color: var(--fg); }
.lang__btn[aria-pressed="true"] { color: var(--fg); }
.lang__btn[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 0.5rem; right: 0.5rem; bottom: 0.15rem;
  height: 1px;
  background: var(--accent);
}

.nav__toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line-strong);
  align-items: center;
  justify-content: center;
}
.nav__toggle-bars,
.nav__toggle-bars::before,
.nav__toggle-bars::after {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--fg);
  transition: transform 0.25s ease, background-color 0.2s;
}
.nav__toggle-bars { position: relative; }
.nav__toggle-bars::before,
.nav__toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav__toggle-bars::before { top: -6px; }
.nav__toggle-bars::after { top: 6px; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars { background: transparent; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding-top: calc(var(--header-h) + clamp(4rem, 2rem + 8vw, 9.5rem));
  padding-bottom: clamp(4rem, 3rem + 5vw, 7.5rem);
}

.hero__title {
  font-size: var(--fs-h1);
  font-weight: 700;
  font-stretch: 115%;
  letter-spacing: -0.035em;
  line-height: 0.96;
}
.hero__title-alt { color: var(--muted); }

.hero__foot {
  margin-top: clamp(3rem, 2rem + 5vw, 6rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--line-strong);
}
.hero__kicker {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: var(--fs-small);
  font-weight: 500;
}
.hero__kicker::before {
  content: "";
  flex-shrink: 0;
  width: 8px; height: 8px;
  background: var(--accent);
  transform: translateY(-1px);
}
.hero__lead {
  max-width: 38rem;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.5;
}
.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: 2.5rem;
}

/* ==========================================================================
   Services — numbered index rows
   ========================================================================== */
.service-list {
  counter-reset: service;
  border-top: 1px solid var(--line-strong);
}
.service {
  counter-increment: service;
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr) minmax(0, 1.25fr);
  column-gap: var(--gap);
  align-items: baseline;
  padding-block: clamp(1.75rem, 1.25rem + 1.5vw, 2.75rem);
  border-bottom: 1px solid var(--line-strong);
}
.service::before {
  content: counter(service, decimal-leading-zero);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.service__title { font-size: var(--fs-h3); }
.service__text { color: var(--muted); max-width: 42ch; }

/* ==========================================================================
   How we work — light band
   ========================================================================== */
.h2-alt { color: var(--muted); }

.statement {
  margin-top: 2rem;
  max-width: 34rem;
  font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3rem);
  font-weight: 600;
  line-height: 1.4;
}

.principles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.5rem var(--gap);
}
.principle {
  padding-top: 1.25rem;
  border-top: 2px solid var(--fg);
}
.principle h3 { font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.2; }
.principle p { margin-top: 0.75rem; color: var(--muted); font-size: var(--fs-small); }

/* ==========================================================================
   About
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem var(--gap);
  align-items: start;
}

.values li {
  padding-block: 1.25rem;
  border-top: 1px solid var(--line-strong);
}
.values li:last-child { border-bottom: 1px solid var(--line-strong); }
.values h3 { font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.2; }
.values p { margin-top: 0.4rem; color: var(--muted); font-size: var(--fs-small); }

.facts > div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 1rem;
  border-top: 1px solid var(--line-strong);
}
.facts > div:last-child { border-bottom: 1px solid var(--line-strong); }
.facts dt { color: var(--muted); font-size: var(--fs-small); }
.facts dd { font-size: var(--fs-small); font-weight: 600; }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 3rem var(--gap);
  align-items: start;
}
.contact h2 { margin-top: 1rem; }
.contact__points {
  margin-top: 2.5rem;
  border-top: 1px solid var(--line-strong);
}
.contact__points li {
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line-strong);
  font-size: var(--fs-small);
  font-weight: 500;
}

/* ---------- Email ---------- */
.contact__direct {
  padding-top: 1.75rem;
  border-top: 2px solid var(--fg);
}
.contact__label {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--muted);
}
.contact__email {
  display: inline-block;
  max-width: 100%;
  margin-top: 0.75rem;
  font-size: clamp(1.3rem, 0.85rem + 1.6vw, 2.1rem);
  font-weight: 700;
  font-stretch: var(--wide);
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease;
}
.contact__email:hover { color: var(--accent); }
.contact__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: 2.5rem;
}
.contact__copy[hidden] { display: none; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); }
.footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding-block: 2.75rem;
}
.footer__nav { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; }
.footer__nav a { color: var(--muted); font-size: var(--fs-small); transition: color 0.15s ease; }
.footer__nav a:hover { color: var(--fg); }
.footer__bottom {
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1140px) {
  /* Stacked: the facts list continues the values list as one ruled column */
  .about-grid { grid-template-columns: 1fr; row-gap: 0; }
  .values li:last-child { border-bottom: 0; }
}

@media (max-width: 1024px) {
  .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  /* Single column: labels sit above their content */
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-label,
  .col-body { grid-column: 1; }
  .sec-label { padding-top: 0; margin-bottom: 1rem; }
  .hero__kicker { margin-bottom: 1.5rem; }

  .service {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    row-gap: 0.75rem;
  }
  .service__text { grid-column: 2; }

  .about-grid { grid-template-columns: 1fr; }

  /* Mobile navigation */
  .nav__toggle { display: inline-flex; }
  .nav__cta { display: none; }
  .nav__links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--pad-x) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
  }
  .site-header.is-open .nav__links { opacity: 1; visibility: visible; }
  .nav__links li:not(.nav__mobile-cta) { border-bottom: 1px solid var(--line); }
  .nav__links a:not(.btn) { display: block; padding-block: 1rem; font-size: 1.125rem; }
  .nav__links a.is-active::after { display: none; }
  .nav__mobile-cta { display: block; margin-top: 1.25rem; }
  .nav__mobile-cta .btn { width: 100%; }
}
@media (min-width: 861px) {
  .nav__mobile-cta { display: none; }
}

@media (max-width: 560px) {
  :root { --header-h: 68px; }
  .logo img { height: 36px; }
  .principles { grid-template-columns: 1fr; }
  .facts > div { grid-template-columns: 1fr; gap: 0.2rem; }
}
