/* base.css — "fine" template: editorial.
 *
 * A complete, quality-gated design system (hand-rolled BEM, framework-free).
 * The build agent copies this file verbatim into a site's `style.css` and
 * overwrites ONLY the delimited brand-parameter block below — every other rule
 * ships byte-identical, which is how the fixture's Lighthouse/axe pass transfers
 * to every real build. See TEMPLATE.md for the character spec and the
 * brand-parameter contract (which properties to fill, how tints/shades derive).
 *
 * Character: refined, elegant-professional — high-contrast display serif over a
 * clean sans, small crisp radii (2-4px), near-monochrome ink-on-paper, hairline
 * rules and generous whitespace instead of shadows (one float shadow is reserved
 * for fixed overlays), slow deliberate deceleration motion. Shares the BEM
 * vocabulary of the "soft" and "sharp" templates so a site's HTML renders under
 * any of the three stylesheets unchanged. Fonts load via <link> in the HTML head.
 */

/* ── Brand parameters (per-site) ─────────────────────────────────────────────
 * The ONLY block the build agent edits. Fill from the extracted brand (logo
 * colours, screenshot palette, tone). Keep every property; adjust its value.
 * Contrast contract: --color-text and --color-muted must hold >= 4.5:1 on
 * --color-surface and --color-surface-alt; --color-on-primary must hold >= 4.5:1
 * on --color-primary; --color-primary used as link text must hold >= 4.5:1 on
 * --color-surface. --color-accent is DECORATIVE ONLY (rules, marks, nav
 * underline) — never load-bearing text unless it independently meets 4.5:1.
 * Because primary sits close to text in a near-monochrome scheme, body links keep
 * their underline (the reset preserves it) so affordance never rests on colour.
 * Fonts must be one of TEMPLATE.md's approved display-serif + clean-sans pairs. */
:root {
  --color-primary: #1f2124;        /* charcoal ink (from logo/suit) — links, buttons, ink blocks */
  --color-primary-shade: #131416;  /* darker primary for hover/active (derive: primary ~12% darker) */
  --color-primary-tint: #ededee;   /* pale wash for icon plates / hero (derive: primary mixed ~92% white) */
  --color-on-primary: #f7f6f3;     /* warm near-white text/icons on --color-primary blocks */
  --color-accent: #a6323c;         /* dusty brand red (from the chart accent) — fine rules and marks, decorative only */
  --color-surface: #f8f9fa;        /* cool paper white page background */
  --color-surface-alt: #eef0f2;    /* light cool stone for alternating sections */
  --color-text: #1a1c1e;           /* neutral ink body text */
  --color-muted: #565b60;          /* muted ink-grey secondary text (>= 4.5:1 on both surfaces) */
  --color-border: #dbdee1;         /* pale cool-stone hairline */

  --font-heading: 'Spectral', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
/* ── end Brand parameters ──────────────────────────────────────────────────── */

/* ── Fixed tokens (the template character — do not edit per site) ──────────── */
:root {
  /* Type scale 1.414 (augmented fourth), fluid via clamp; body line-height 1.6.
     Top two steps widened for display drama (same convention as sharp). */
  --step--1: clamp(0.8rem, 0.78rem + 0.13vw, 0.875rem);
  --step-0: clamp(1rem, 0.96rem + 0.18vw, 1.125rem);
  --step-1: clamp(1.41rem, 1.36rem + 0.29vw, 1.59rem);
  --step-2: clamp(2rem, 1.92rem + 0.42vw, 2.25rem);
  --step-3: clamp(2.83rem, 2.71rem + 0.59vw, 3.18rem);
  --step-4: clamp(3.36rem, 2.89rem + 2.33vw, 4.76rem);
  --step-5: clamp(3.9rem, 3.08rem + 4.08vw, 6.35rem);
  --leading-body: 1.6;
  --leading-tight: 1.1;

  /* Spacing — the most generous of the three; 1.5rem base rhythm. */
  --space-3xs: 0.375rem;
  --space-2xs: 0.75rem;
  --space-xs: 1rem;
  --space-s: 1.5rem;
  --space-m: 2.5rem;
  --space-l: 4rem;
  --space-xl: 6rem;
  --section-pad: clamp(4rem, 2.8rem + 6vw, 7.5rem);
  --container-max: 68rem; /* narrower, elegant measure */

  /* Small crisp radii — the fine character (between sharp's 0-2 and soft's 8-24). */
  --radius-s: 2px;
  --radius-m: 3px;
  --radius-l: 4px;
  --radius-pill: 4px;

  /* Elevation = whitespace + hairline rules. No card shadows; --shadow-float is
     reserved for fixed overlays (cookie banner, mobile nav sheet) that cannot
     float on whitespace alone. --border-rule is the broadsheet top rule. */
  --border-hair: 1px solid var(--color-border);
  --border-rule: 2px solid var(--color-text);
  --shadow-float: 0 8px 24px rgba(32, 29, 26, 0.08);

  /* Slow deliberate deceleration, 600-700ms — a long ease-out. */
  --ease-fine: cubic-bezier(0.19, 1, 0.22, 1);
  --dur-reveal: 640ms;
  --dur-hover: 300ms;

  --header-h: 4.5rem;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}
/* Body-copy links stay underlined: in a near-monochrome scheme, primary sits
   close to text, so the underline (not colour) is the affordance (WCAG 1.4.1). */
a {
  color: var(--color-primary);
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--color-primary-shade);
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  font-weight: 600; /* every approved heading face carries a 600 — renders alike */
  color: var(--color-text);
  letter-spacing: -0.01em;
}
h1 {
  font-size: var(--step-4);
}
h2 {
  font-size: var(--step-3);
}
h3 {
  font-size: var(--step-2);
}
ul,
ol {
  padding-left: 1.25em;
}

/* Visible, high-contrast focus ring for keyboard users on every interactive
   element — primary, never the sub-AA accent; never removed without a
   equal-or-better replacement. */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-s);
}
/* Accessible visually-hidden text (labels for icon-only controls, etc.). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Skip link: off-screen until focused, then pinned top-left for keyboard users. */
.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -4rem;
  z-index: 100; /* above the sticky header */
  padding: var(--space-2xs) var(--space-xs);
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-s);
  transition: top var(--dur-hover) var(--ease-fine);
}
.skip-link:focus {
  top: var(--space-2xs);
  color: var(--color-on-primary);
}

/* Scroll-reveal: only hidden when JS is active (root .js), so no-JS keeps all
   content visible. main.js adds .is-visible as elements enter the viewport. The
   16px lift is a settle, not a slide — deliberate, in keeping with the character. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-reveal) var(--ease-fine), transform var(--dur-reveal) var(--ease-fine);
}
.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ── Kickers (shared hero/section eyebrow — uppercase, letterspaced, with an
      accent rule that grows in on load) ─────────────────────────────────────── */
.hero__kicker,
.section__kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-bottom: var(--space-s);
  font-family: var(--font-body); /* sans eyebrow, distinct from the serif headings */
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: var(--step--1);
  color: var(--color-primary); /* text slot — primary carries the contrast; accent stays decorative */
}
/* A short brass rule trailing the eyebrow (decorative — accent is sub-AA, never text). */
.hero__kicker::after,
.section__kicker::after {
  content: '';
  width: 2.5rem;
  height: 2px;
  background: var(--color-accent);
  transform-origin: left;
}
.js .hero__kicker::after,
.js .section__kicker::after {
  animation: rule-grow var(--dur-reveal) var(--ease-fine) both;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3xs);
  min-height: 3rem; /* comfortable tap target */
  padding: 0.85rem 1.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-s); /* crisp rectangle — the fine character */
  font-weight: 600;
  font-size: var(--step-0);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-hover) var(--ease-fine), color var(--dur-hover) var(--ease-fine),
    border-color var(--dur-hover) var(--ease-fine);
}
/* Primary = solid ink block. */
.button--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}
.button--primary:hover {
  background: var(--color-primary-shade);
  color: var(--color-on-primary);
  border-color: var(--color-primary-shade);
}
/* Ghost = 1px hairline that darkens to ink on hover — no fill, no lift, no shadow. */
.button--ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-border);
}
.button--ghost:hover {
  color: var(--color-primary-shade);
  border-color: var(--color-primary);
}

/* ── Header / navigation ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50; /* above page content, below the skip link */
  /* Opaque, not a translucent backdrop-blur: blur() forces a GPU repaint on
     every scroll frame, which spikes rendering cost — an opaque header keeps the
     sticky nav cheap and the paint deterministic. */
  background: var(--color-surface);
  border-bottom: var(--border-hair);
  transition: border-color var(--dur-hover) var(--ease-fine);
}
/* main.js adds --stuck once scrolled off the top; strengthen the hairline to the
   broadsheet rule. */
.site-header--stuck {
  border-bottom: var(--border-rule);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  min-height: var(--header-h);
}
.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--color-text);
  text-decoration: none;
}
.site-header__logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-s);
}
.nav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: transparent;
  border: var(--border-hair);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.nav__toggle-bars {
  position: relative;
  width: 1.25rem;
  height: 1px;
  background: var(--color-text);
}
.nav__toggle-bars::before,
.nav__toggle-bars::after {
  content: '';
  position: absolute;
  left: 0;
  width: 1.25rem;
  height: 1px;
  background: var(--color-text);
}
.nav__toggle-bars::before {
  top: -6px;
}
.nav__toggle-bars::after {
  top: 6px;
}
.nav__menu {
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav__item {
  margin: 0;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 var(--space-2xs);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent; /* accent underline target */
  transition: border-color var(--dur-hover) var(--ease-fine), color var(--dur-hover) var(--ease-fine);
}
.nav__link:hover,
.nav__link--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent); /* decorative accent underline */
}

/* Mobile-first: nav collapses behind the toggle; expands to a row at >= 48rem. */
@media (max-width: 47.99rem) {
  .nav__menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    padding: var(--space-2xs) var(--space-s) var(--space-s);
    background: var(--color-surface);
    border-top: var(--border-hair);
    /* The open sheet floats over content — the one place a shadow is warranted. */
    box-shadow: var(--shadow-float);
  }
  .nav__menu--open {
    display: flex;
  }
  .nav__link {
    width: 100%;
    border-bottom: var(--border-hair);
  }
}
@media (min-width: 48rem) {
  .nav__toggle {
    display: none;
  }
  .nav__menu {
    display: flex;
    align-items: center;
    gap: var(--space-s);
  }
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding-block: var(--section-pad);
  /* A near-monochrome scheme: a faint paper wash, no bold block. */
  background:
    radial-gradient(120% 90% at 100% 0%, var(--color-primary-tint), transparent 55%),
    var(--color-surface);
  border-bottom: var(--border-hair);
  overflow: hidden; /* contains the framed media bleed on small screens */
}
.hero__inner {
  display: grid;
  gap: var(--space-l);
  align-items: center;
}
.hero__body {
  min-width: 0; /* grid child: keep a long word from blowing out the text column */
}
.hero__title {
  font-size: var(--step-5);
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 15ch; /* a ch cap limits swap reflow (CLS) at the display size */
}
.hero__text {
  margin-top: var(--space-s);
  font-size: var(--step-1);
  color: var(--color-muted);
  max-width: 46ch;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-m);
}
.hero__media {
  border: var(--border-hair); /* a fine editorial frame, not a shadow */
  border-radius: var(--radius-l);
  overflow: hidden;
  animation: hero-settle var(--dur-reveal) var(--ease-fine) both;
}
.hero__art {
  width: 100%;
  height: auto;
}
@media (min-width: 56rem) {
  .hero__inner {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

/* ── Section scaffolding ─────────────────────────────────────────────────── */
.section {
  padding-block: var(--section-pad);
}
.section--alt {
  background: var(--color-surface-alt);
}
.section__head {
  max-width: 52ch;
  margin-bottom: var(--space-l);
}
.section__title {
  font-size: var(--step-3);
}
.section__lead {
  margin-top: var(--space-s);
  color: var(--color-muted);
  font-size: var(--step-1);
}

/* ── Cards (broadsheet top-rule + whitespace — no shadow, no numbering) ────── */
.card-grid {
  display: grid;
  gap: var(--space-l);
  grid-template-columns: 1fr;
}
@media (min-width: 40rem) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 60rem) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.card {
  padding-top: var(--space-s);
  background: transparent;
  border-top: var(--border-rule); /* the editorial rule that heads each card */
  transition: border-color var(--dur-hover) var(--ease-fine);
}
.card:hover {
  border-top-color: var(--color-accent); /* a quiet brass shift, no lift */
}
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: var(--space-s);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  border-radius: var(--radius-s);
}
.card__title {
  font-size: var(--step-2);
  margin-bottom: var(--space-2xs);
}
.card__text {
  color: var(--color-muted);
}

/* ── Gallery ─────────────────────────────────────────────────────────────── */
.gallery {
  display: grid;
  gap: var(--space-s);
  grid-template-columns: 1fr;
}
@media (min-width: 40rem) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 60rem) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}
.gallery__item {
  overflow: hidden;
  border: var(--border-hair); /* fine frame, not a rounded shadowed tile */
  border-radius: var(--radius-l);
}
.gallery__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform var(--dur-hover) var(--ease-fine);
}
.gallery__item:hover .gallery__image {
  transform: scale(1.03);
}

/* ── Testimonial (oversized serif quote between thin rules — no tinted box) ── */
.testimonial {
  max-width: 40ch;
  margin-inline: auto;
  padding-block: var(--space-l);
  text-align: center;
  border-top: var(--border-hair);
  border-bottom: var(--border-hair);
}
.testimonial__quote {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.25;
}
.testimonial__author {
  display: block;
  margin-top: var(--space-s);
  font-family: var(--font-body);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--step--1);
  color: var(--color-muted);
}

/* ── FAQ ─────────────────────────────────────────────────────────────────── */
.faq {
  max-width: 52rem;
  margin-inline: auto;
  border-top: var(--border-hair);
}
.faq__item {
  padding-block: var(--space-s);
  border-bottom: var(--border-hair);
}
.faq__question {
  font-size: var(--step-1);
  margin-bottom: var(--space-2xs);
}
.faq__answer {
  color: var(--color-muted);
  max-width: 60ch;
}

/* ── Contact form (posts via mailto — no runtime dependency) ─────────────── */
.contact-form {
  display: grid;
  gap: var(--space-s);
  max-width: 40rem;
}
.contact-form__field {
  display: grid;
  gap: var(--space-3xs);
}
.contact-form__label {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--step--1);
}
.contact-form__input,
.contact-form__textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--color-surface);
  border: var(--border-hair);
  border-radius: var(--radius-s);
}
.contact-form__input:focus,
.contact-form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-tint);
}
.contact-form__textarea {
  min-height: 8rem;
  resize: vertical;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  padding-block: var(--space-xl) var(--space-l);
  background: var(--color-surface-alt);
  border-top: var(--border-rule); /* broadsheet rule closes the page */
}
.site-footer__inner {
  display: grid;
  gap: var(--space-l);
  grid-template-columns: 1fr;
}
@media (min-width: 48rem) {
  .site-footer__inner {
    grid-template-columns: repeat(3, 1fr);
  }
}
.site-footer__heading {
  font-family: var(--font-heading);
  font-size: var(--step-1);
  margin-bottom: var(--space-s);
}
.site-footer__link {
  display: block;
  padding: var(--space-3xs) 0;
  color: var(--color-text);
  text-decoration: none;
}
.site-footer__link:hover {
  color: var(--color-primary);
}
.site-footer__legal {
  margin-top: var(--space-l);
  padding-top: var(--space-s);
  border-top: var(--border-hair);
  color: var(--color-muted);
  font-size: var(--step--1);
}

/* ── Legal page ──────────────────────────────────────────────────────────── */
.legal {
  max-width: 62ch;
  margin-inline: auto;
  padding-block: var(--section-pad);
}
.legal__title {
  margin-bottom: var(--space-m);
}
.legal__body > * + * {
  margin-top: var(--space-s);
}
.legal__body h2 {
  font-size: var(--step-2);
  margin-top: var(--space-l);
}

/* ── Cookie banner (used only when a site sets cookies; main.js dismisses) ── */
.cookie-banner {
  position: fixed;
  left: var(--space-s);
  right: var(--space-s);
  bottom: var(--space-s);
  z-index: 80; /* above content, below the skip link */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) var(--space-m);
  background: var(--color-surface);
  border: var(--border-hair);
  border-radius: var(--radius-m);
  /* A fixed overlay cannot float on whitespace alone — the one place a shadow is used. */
  box-shadow: var(--shadow-float);
}
.cookie-banner__text {
  flex: 1 1 16rem;
  color: var(--color-muted);
  font-size: var(--step--1);
}
.cookie-banner__actions {
  display: flex;
  gap: var(--space-2xs);
}

/* ── Demo banner (pre-contract preview marker) ───────────────────────────── */
.demo-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90; /* above the cookie banner */
  padding: var(--space-2xs) var(--space-s);
  text-align: center;
  background: var(--color-primary); /* ink block carries --color-on-primary at >= 4.5:1 */
  color: var(--color-on-primary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--step--1);
}

/* ── Error (404) page ────────────────────────────────────────────────────── */
.error-page {
  display: grid;
  place-content: center;
  gap: var(--space-s);
  min-height: 60vh;
  padding: var(--section-pad) var(--space-s);
  text-align: center;
}
.error-page__code {
  font-family: var(--font-heading);
  font-size: var(--step-5);
  color: var(--color-primary);
}
.error-page__title {
  font-size: var(--step-3);
}
.error-page__text {
  color: var(--color-muted);
  max-width: 40ch;
  margin-inline: auto;
}

/* ── Motion keyframes ────────────────────────────────────────────────────── */
/* hero-settle: the hero media eases up ~14px on load, slowly. Transform-only —
   no opacity fade — so the (large) hero media paints immediately and never
   delays Largest Contentful Paint. */
@keyframes hero-settle {
  from {
    transform: translateY(14px);
  }
  to {
    transform: none;
  }
}
/* rule-grow: a horizontal accent rule scales in left-to-right for section-head
   and kicker underlines. */
@keyframes rule-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* ── Site-specific composition ─────────────────────────────────────────────
 * The template's .hero__title uses `hyphens: auto`, which splits the business
 * name mid-word ("Kivi-mäki") at the display size. Disable auto-hyphenation
 * here so the proper noun wraps on whole words only. Layout-only, no new
 * tokens. (Underlying template gap flagged for the backlog.) */
.hero__title {
  hyphens: manual;
}
