/* Hallmark · genre: editorial · macrostructure: Split Studio · theme: Almanac
 * tone: technical · anchor hue: 78 (warm oat) · accent: oxide red ~2 % coverage
 * nav: N6 Newspaper masthead (issue-line=below, wordmark=2xl, rule=double)
 * footer: Ft4 Dense colophon (family=monospace, layout=single block)
 * components: H2 split diptych (ratio 7/5, right=photo, divider=negative space)
 *           · S2 hanging heads · F3 spec sheet (cols=2, rules=every row, tabular)
 *           · C1 outlined chip (rect, spacious, arrow=none) · C3 typographic link
 * enrichment: none — typography + photography only
 * motion: stagger-reveal (one-shot IO) · cta-press. 2 primitives, 0.85× scale.
 * eyebrows: zero
 * pre-emit critique: P4 H5 E4 S5 R5 V5
 * contrast: pass (40–41) · slop: pass (42–45) · honest: pass (46)
 * chrome: pass (47) · tokens: pass (48) · responsive: pass (49) · icons: pass (30)
 * mobile: pass (34, 49, 50–57) — verified 320/375/414/768/960/1280/1440/1920
 */

@import url("tokens.css");

/* ── Reset ─────────────────────────────────────────────────────────── */

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

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

body {
  overflow-x: clip;                       /* Safari fallback */
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-style: normal;                     /* headings are roman, always */
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  overflow-wrap: anywhere;
  hyphens: manual;   /* wrap between words; only break inside a word if it cannot fit */
  min-width: 0;
}

p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration-color: var(--color-rule);
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
}

:focus-visible {
  outline: var(--rule-bold) solid var(--color-focus);
  outline-offset: 3px;                    /* never transitioned — instant */
}

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

/* ── Page frame ────────────────────────────────────────────────────── */

.page {
  max-width: 84rem;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.skip {
  position: absolute;
  inset-inline-start: -9999px;
  top: var(--space-xs);
  z-index: var(--z-sticky);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: var(--text-sm);
}
.skip:focus { inset-inline-start: var(--space-md); }

.muted { color: var(--color-muted); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── N6 · Newspaper masthead ───────────────────────────────────────── */

.mast {
  display: grid;
  gap: var(--space-2xs);
  padding-block: var(--space-lg) 0;
  text-align: center;
}

.mast__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 5.2vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0;
  text-decoration: none;
  display: inline-block;
  overflow-wrap: anywhere;
}

.mast__line {
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-sm);
  justify-content: center;
  align-items: baseline;
}
.mast__line a { text-decoration: none; }
.mast__line a:hover { color: var(--color-accent); }
.mast__sep { color: var(--color-rule); }

.mast__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  justify-content: center;
  margin-block-start: var(--space-sm);
}

.mast__link {
  white-space: nowrap;                    /* affordances never wrap (gate 49) */
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding-block: var(--space-2xs);
  border-bottom: var(--rule-bold) solid transparent;
  transition: color var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out);
}
.mast__link:hover { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.mast__link:active { color: var(--color-accent-ink); }

.mast__rule {
  border: 0;
  border-top: var(--rule-hair) solid var(--color-rule);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  height: 4px;
  margin-block: var(--space-md) 0;
}

/* ── H2 · Hero split diptych — 7/5, text left, photo right ─────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xl);
  padding-block: var(--space-2xl) var(--space-3xl);
  align-items: end;
}

.hero__title {
  font-size: var(--text-display);
  max-width: 21ch;                        /* wide enough to set "moottorikoneistusta" unbroken */
}

.hero__lede {
  font-size: var(--text-md);
  line-height: 1.55;
  max-width: 46ch;
  color: var(--color-muted);
  margin-block-start: var(--space-lg);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md) var(--space-xl);
  margin-block-start: var(--space-xl);
}

.hero__figure { margin: 0; }
.hero__figure img {
  width: 100%;
  aspect-ratio: 4 / 5;                    /* crop the portrait so it can't tower over the text */
  object-fit: cover;
  object-position: 50% 35%;
}

/* ── C1 · Outlined chip ────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: var(--space-sm) var(--space-lg);
  border: var(--rule-bold) solid var(--color-ink);
  border-radius: var(--radius-none);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  transition: background-color var(--dur-short) var(--ease-out),
              color var(--dur-short) var(--ease-out),
              transform var(--dur-micro) var(--ease-out);
}
.chip:hover { background: var(--color-ink); color: var(--color-paper); }
.chip:active { transform: translateY(1px); }
.chip[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── C3 · Typographic link ─────────────────────────────────────────── */

.link {
  font-size: var(--text-base);
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: var(--color-rule);
  text-decoration-thickness: 1px;
  transition: color var(--dur-short) var(--ease-out),
              text-decoration-color var(--dur-short) var(--ease-out);
}
.link:hover { color: var(--color-accent); text-decoration-color: var(--color-accent); }
.link:active { color: var(--color-accent-ink); }

/* ── S2 · Hanging section head — single column, no eyebrow ─────────── */

.head {
  padding-block: var(--space-3xl) var(--space-lg);
  border-top: var(--rule-hair) solid var(--color-rule);
}
.head__title {
  font-size: var(--text-2xl);
  max-width: 20ch;
}
.head__note {
  margin-block-start: var(--space-sm);
  max-width: var(--measure);
  color: var(--color-muted);
}

/* ── Split Studio body — alternating diptych modules ───────────────── */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  padding-block: var(--space-xl) var(--space-2xl);
  align-items: start;
}

.split__title {
  font-size: var(--text-xl);
  margin-block-end: var(--space-md);
}

.split__body {
  color: var(--color-muted);
  max-width: 46ch;
}

/* Operation list — hairline rows, the shop's own vocabulary */
.ops {
  margin-block-start: var(--space-lg);
  border-top: var(--rule-hair) solid var(--color-rule);
  max-width: 46ch;
}
.ops li {
  padding-block: var(--space-sm);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-base);
}
.ops li::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-inline-end: 0.75em;
  vertical-align: 0.08em;
  background: var(--color-accent);
}

.split__figure { margin: 0; }
.split__figure img { width: 100%; }

.split__caption {
  margin-block-start: var(--space-sm);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ── F3 · Tabular spec sheet — company facts ───────────────────────── */

.spec {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  margin-block-start: var(--space-xl);
  border-top: var(--rule-hair) solid var(--color-rule);
}
.spec th,
.spec td {
  text-align: start;
  padding-block: var(--space-sm);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  vertical-align: baseline;
}
.spec th {
  font-family: var(--font-outlier);
  font-weight: 400;
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  width: 15ch;
  padding-inline-end: var(--space-md);
}
.spec td { font-size: var(--text-base); }

/* ── Prose ─────────────────────────────────────────────────────────── */

.prose p + p { margin-block-start: var(--space-md); }
.prose { max-width: var(--measure); }

/* ── Contact ───────────────────────────────────────────────────────── */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xl);
  padding-block: var(--space-xl) var(--space-3xl);
}

.contact__list dt {
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.contact__list dd {
  margin: 0 0 var(--space-lg);
  font-size: var(--text-md);
}
.contact__list dd:last-child { margin-block-end: 0; }
.contact__list a { text-decoration-color: var(--color-rule); }
.contact__list a:hover { color: var(--color-accent); text-decoration-color: var(--color-accent); }

/* ── Ft4 · Dense colophon ──────────────────────────────────────────── */

.colophon {
  border-top: var(--rule-bold) solid var(--color-ink);
  padding-block: var(--space-lg) var(--space-2xl);
}
.colophon p {
  font-family: var(--font-outlier);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-muted);
  max-width: 90ch;
}
.colophon a { text-decoration-color: var(--color-rule); white-space: nowrap; }
.colophon a:hover { color: var(--color-accent); }

/* ── Motion — one orchestrated entrance, one-shot ──────────────────── */

/* Content is visible by default. The hiding rule only exists once JS has
   confirmed it can observe and un-hide — a failed observer can never leave
   the page blank. */
.js-anim .reveal {
  opacity: 0;
  transform: translateY(10px);
}
.js-anim .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-long) var(--ease-out),
              transform var(--dur-long) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .js-anim .reveal { opacity: 1; transform: none; }
  .js-anim .reveal.is-in { transition-duration: 150ms; transition-delay: 0ms; }
  .chip { transition-duration: 150ms; }
}

/* ── 40 rem — tablet ───────────────────────────────────────────────── */

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

/* ── 60 rem — desktop: the diptychs open up ────────────────────────── */

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-2xl);
    /* Bottom-heavy on purpose (gate 44a) and short enough that the CTA
       still clears the fold on a 13" 1280×800 laptop (gate 44b). */
    padding-block: var(--space-2xl) var(--space-4xl);
    align-items: center;
  }

  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-2xl);
    padding-block: var(--space-2xl) var(--space-3xl);
    align-items: center;
  }
  /* Alternation: even modules put the photograph on the left. */
  .split--flip .split__text  { grid-column: 2; grid-row: 1; }
  .split--flip .split__figure { grid-column: 1; grid-row: 1; }

  /* Uneven rhythm — the company section leans wider on the text side. */
  .split--company { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }

  .contact { grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: var(--space-3xl); }

  .head { padding-block: var(--space-4xl) var(--space-xl); }
}
