/* ====================================================================
   Pesosenpuoti — style.css
   Finnish Baltic maritime craft. Committed brand colour strategy.
   Palette anchored to seed oklch(0.650 0.100 230) per Impeccable.
   ==================================================================== */

/* --- Tokens --------------------------------------------------------- */
:root {
  /* Palette — Finnish summer dawn on the Baltic */
  --color-bg:      oklch(1.000 0.000 0);                      /* pure white — brand carries atmosphere */
  --color-surface: oklch(0.965 0.008 228);                    /* barely-tinted panel background */
  --color-navy:    oklch(44.5% 0.115 236);                    /* light scandinavian navy — headings, dark fills */
  --color-brand:   oklch(0.560 0.145 232);                    /* committed Baltic blue — links, borders, accents */
  --color-warm-tree:   oklch(0.70 0.15 85);                   /* warm tree
  --color-oak:      oklch(72% 0.09 75);                         /* oak-tan wood accent */
  --color-mahogany: oklch(38% 0.09 30);                       /* mahogany wood accent */
  --color-ink:     oklch(0.170 0.020 232);                    /* near-black with blue cast — body copy */
  --color-muted:   oklch(0.480 0.018 228);                    /* secondary text — ≥3.5:1 vs bg */
  --color-white:   oklch(1.000 0.000 0);                      /* text on dark fills */
  --color-rule:    oklch(0.890 0.012 228);                    /* dividers, card borders */
  --color-navbar:  oklch(17.024% 0.02072 288.565 / 0.60);     /* navbar background top — overlays hero photo, same in both themes */
  --color-navbar-scrolled: oklch(100% 0.00011 271.152 / 0.337);       /* navbar background scrolled (light theme) */
  --color-wave:    112 158 196;                                /* canvas wave fill "r g b" (light theme) — read by wave.js, not sampled from the photo */
  --color-palvelut-bg:oklch(83.14% 0.05085 227.895);                 /* pale Baltic-blue section tint (light theme) */

  /* Typography */
  --font-heading: 'Barlow', system-ui, sans-serif;
  --font-body:    system-ui, -apple-system, sans-serif;

  /* Scale */
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 18px;

  /* Shadows */
  --shadow-card:       0 1px 6px oklch(0.220 0.060 235 / 0.07);
  --shadow-card-hover: 0 8px 28px oklch(0.220 0.060 235 / 0.13);

  /* Motion */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out:    cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 160ms;
  --dur-mid:  300ms;
  --dur-slow: 560ms;

  /* Layout */
  --max-w: 1140px;
  --pad-x: clamp(1.25rem, 5vw, 3rem);
  --pad-y: clamp(4.5rem, 9vw, 8rem);
}

/* --- Reset ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video {
  display: block;
  max-width: 100%;
}

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

/* Global focus-visible — keyboard navigation */
:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

/* --- Typography ----------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-navy);
  letter-spacing: -0.01em;
}

/* Fluid modular scale — ratio ~1.35 */
h1 { font-size: clamp(2.2rem, 5.3vw, 4rem); }
h2 { font-size: clamp(1.85rem, 3.8vw, 2.9rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.3rem); font-weight: 600; }

p {
  max-width: 64ch;
  line-height: 1.7;
}

/* --- Layout utilities ----------------------------------------------- */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.section-pad {
  padding-block: var(--pad-y);
}

/* --- Buttons -------------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.85em 1.8em;
  background: var(--color-warm-tree);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  transition:
    filter var(--dur-fast) var(--ease-out-quart),
    transform var(--dur-fast) var(--ease-out-quart),
    box-shadow var(--dur-fast) var(--ease-out-quart);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px oklch(0.620 0.140 65 / 0.30);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  filter: brightness(0.98);
}

.btn-primary:focus-visible {
  outline: 3px solid var(--color-warm-tree);
  outline-offset: 3px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.85em 1.8em;
  border: 1.5px solid oklch(1.000 0.000 0 / 0.55);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.btn-ghost:hover {
  border-color: var(--color-white);
  background: oklch(1.000 0.000 0 / 0.10);
}

.btn-ghost:active {
  transform: scale(0.97);
}

.btn-ghost:focus-visible {
  outline: 3px solid oklch(1.000 0.000 0 / 0.7);
  outline-offset: 3px;
}

/* --- Hero entrance -------------------------------------------------- */
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Scroll fade-in animation --------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--dur-slow) var(--ease-out-quart),
    transform var(--dur-slow) var(--ease-out-quart);
  /* Stagger via --i: 0, 1, 2, 3 set on the element */
  transition-delay: calc(var(--i, 0) * 90ms);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html { scroll-behavior: auto; }
  * {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

/* --- Navbar --------------------------------------------------------- */
.navbar {
  margin-top: 5rem;
  position: fixed;
  background-color: var(--color-navbar);
  backdrop-filter: blur(5px);
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition:
    background var(--dur-mid) var(--ease-in-out),
    padding var(--dur-mid) var(--ease-in-out),
    box-shadow var(--dur-mid) var(--ease-in-out);
}

.navbar.scrolled {
  background: var(--color-navbar-scrolled);
  backdrop-filter: blur(5px);
  box-shadow: 0 1px 0 var(--color-rule);
}

.navbar__inner {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad-x);
  padding-block: 1.4rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  transition: padding-block var(--dur-mid) var(--ease-in-out);
}

.navbar.scrolled .navbar__inner {
  padding-block: 0.9rem;
}

.navbar__logo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3rem;
  min-width: 9rem;
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  transition: color var(--dur-fast);
}

.navbar.scrolled .navbar__logo {
  color: var(--color-navy);
  min-height: 2.4rem;
  min-width: 7.2rem;
}

/* Fixed navy pill behind the (white-on-transparent) wordmark, matching the
   agency's print/social artwork — the badge itself never swaps with the
   page theme, so the logo reads the same against any background. */
.navbar__logo-badge {
  display: inline-flex;
  align-items: center;
  background: oklch(44.5% 0.115 236);
  border-radius: 0.5rem;
  padding: 0.55rem 0.85rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: padding var(--dur-mid) var(--ease-in-out);
}

.navbar.scrolled .navbar__logo-badge {
  padding: 0.4rem 0.65rem;
}

.navbar__logo-mark {
  flex-shrink: 0;
  height: 1.6rem;
  width: auto;
  display: block;
  transition: height var(--dur-mid) var(--ease-in-out);
}

.navbar.scrolled .navbar__logo-mark {
  height: 1.3rem;
}

.navbar__logo-badge--footer {
  padding: 0.6rem 0.9rem;
}

.yhteystiedot__logo .navbar__logo-mark,
.navbar__logo-badge--footer img {
  height: 1.9rem;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  margin-left: auto;
}

.navbar__links a {
  color: oklch(1.000 0.000 0 / 0.85);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  transition: color var(--dur-fast), opacity var(--dur-fast);
  position: relative;
}

.navbar__links a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 100%;
  height: 1px;
  background: var(--color-warm-tree);
  transition: right var(--dur-mid) var(--ease-out-quart);
}

.navbar__links a:hover::after { right: 0; }

.navbar.scrolled .navbar__links a {
  color: var(--color-ink);
}

.navbar.scrolled .navbar__links a:hover {
  color: var(--color-brand);
}

/* Hamburger — 44x44 touch target */
.navbar__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
  padding: 10px 8px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  align-items: center;
}

.navbar__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-white);
  border-radius: 1px;
  transition:
    transform var(--dur-mid) var(--ease-out-quart),
    opacity var(--dur-fast);
}

.navbar.scrolled .navbar__hamburger span {
  background: var(--color-navy);
}

.navbar__hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar__hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.navbar__hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu */

/* Two rules that must both hold, or the menu misbehaves:
   1) [hidden] — an author `display` declaration outranks the UA rule behind
      the hidden attribute, so without this the menu hangs open permanently
      and the hamburger toggle has no visible effect.
   2) the desktop guard below — the hamburger is only shown under 760px, so
      above that the panel must never be able to appear at all. */
.navbar__mobile[hidden] {
  display: none;
}

.navbar__mobile {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border-top: 1px solid var(--color-rule);
  padding: 0.5rem var(--pad-x) 1.5rem;
  box-shadow: 0 8px 24px oklch(0.220 0.060 235 / 0.10);
}

.navbar__mobile a {
  color: var(--color-navy);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-rule);
  transition: color var(--dur-fast), padding-left var(--dur-fast);
}

.navbar__mobile a:last-child {
  border-bottom: none;
}

.navbar__mobile a:hover {
  color: var(--color-brand);
  padding-left: 0.5rem;
}

@media (max-width: 760px) {
  .navbar__links { display: none; }
  .navbar__hamburger { display: flex; }
}

/* Desktop: the hamburger is hidden, so the panel it controls must be too —
   regardless of any stale aria-expanded/hidden state left by a resize. */
@media (min-width: 761px) {
  .navbar__mobile { display: none; }
}

/* --- Hero ----------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--color-navy);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.hero__image {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.52;
  overflow: hidden;
}

.hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transform: scale(var(--image-scale, 1));
  transform-origin: var(--image-position-x, 50%) var(--image-position-y, 50%);
}

.hero__content {
  position: relative;
  z-index: 2;
  padding-block: clamp(6rem, 12vw, 15rem);
  padding-inline: var(--pad-x);
  max-width: var(--max-w);
  margin-inline: auto;
  width: 100%;
}

.hero__eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(78% 0.15 60);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 12px rgba(0, 0, 0, 0.35);
  margin-bottom: 1.25rem;
  animation: hero-rise 700ms var(--ease-out-quart) 120ms both;
}

.hero__heading {
  color: var(--color-white);
  max-width: 17ch;
  margin-bottom: 1.5rem;
  line-height: 1.08;
  letter-spacing: -0.02em;
  animation: hero-rise 800ms var(--ease-out-quart) 240ms both;
}

/* Slogan istuu otsikon ja palvelutiivistelmän välissä: hillitty, viivalla
   merkitty sivuhuomio, jotta se luetaan mottona eikä kilpaile h1:n kanssa. */
.hero__slogan {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 1.5rem;
  max-width: 34ch;
  font-family: var(--font-heading);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--color-white);
  animation: hero-rise 750ms var(--ease-out-quart) 320ms both;
}

.hero__slogan::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  width: 3px;
  border-radius: 2px;
  background: var(--color-warm-tree);
}

.hero__sub {
  color: oklch(0.850 0.015 228);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  max-width: 52ch;
  margin-bottom: 2.75rem;
  line-height: 1.65;
  animation: hero-rise 700ms var(--ease-out-quart) 380ms both;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  animation: hero-rise 600ms var(--ease-out-quart) 500ms both;
}

@media (prefers-reduced-motion: reduce) {
  .hero__eyebrow,
  .hero__heading,
  .hero__slogan,
  .hero__sub,
  .hero__cta {
    animation: none;
  }
}

/* --- Palvelut ------------------------------------------------------- */
.palvelut {
  background: var(--color-palvelut-bg);
  padding-block: var(--pad-y);
}

.palvelut__header {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.palvelut__header h2 {
  margin-bottom: 0.75rem;
}

.palvelut__header p {
  color: var(--color-muted);
  font-size: 1.05rem;
}

/* Offset repair stories — inspired by the supplied workshop reference */
.palvelut__rows {
  display: flex;
  flex-direction: column;
  gap: clamp(2.75rem, 6vw, 5rem);
}

.palvelut__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  position: relative;
}

.palvelut__row .palvelu-photo {
  grid-column: 2;
  grid-row: 1;
  margin-left: clamp(-3rem, -6vw, -1.5rem);
  aspect-ratio: 4 / 3.15;
  border-radius: 0;
}

.palvelut__row:nth-child(even) .palvelu-photo {
  grid-column: 1;
  order: -1;
  margin-left: 0;
  margin-right: clamp(-3rem, -6vw, -1.5rem);
}

.palvelu-photo {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-card);
}

.palvelu-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transform: scale(var(--image-scale, 1));
  transform-origin: var(--image-position-x, 50%) var(--image-position-y, 50%);
}

@media (max-width: 720px) {
  .palvelut__row { grid-template-columns: 1fr; gap: 0; }
  .palvelut__row .palvelu-photo,
  .palvelut__row:nth-child(even) .palvelu-photo { grid-column: 1; grid-row: 1; margin: 0; }
}

/* Cards: no icon-above-h3 — use bold number as visual anchor */
.palvelu-card {
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--dur-mid) var(--ease-out-quart);
}

.palvelu-card--service {
  padding: 2.25rem 2rem;
  background: var(--color-bg);
  border-radius: 0;
  box-shadow: var(--shadow-card-hover);
  z-index: 1;
}

.palvelu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--color-brand);
  opacity: 0;
  transition: opacity var(--dur-mid);
}

.palvelu-card:hover::before {
  opacity: 1;
}

.palvelu-card__link {
  display: inline-block;
  margin-top: 1.1rem;
  color: var(--color-brand);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color var(--dur-fast);
}

.palvelu-card__link:hover {
  color: var(--color-navy);
}

.palvelu-card__num {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.8rem;
  color: var(--color-brand);
  opacity: 0.18;
  line-height: 1;
  margin-bottom: 1.25rem;
  letter-spacing: -0.04em;
  user-select: none;
}

.palvelu-card h3 {
  color: var(--color-navy);
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

.palvelu-card p {
  color: var(--color-ink);
  font-size: 0.95rem;
  line-height: 1.65;
}

.palvelu-card__list {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.palvelu-card__list li {
  font-size: 0.88rem;
  color: var(--color-muted);
  padding-left: 1em;
  position: relative;
}

.palvelu-card__list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--color-brand);
  opacity: 0.6;
}

/* --- Galleria ------------------------------------------------------- */
.galleria {
  background: var(--color-surface);
  padding-block: var(--pad-y);
}

.galleria__header {
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.galleria__header a {
  color: var(--color-brand);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: color var(--dur-fast);
}

.galleria__header a:hover {
  color: var(--color-navy);
}

.galleria__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  background: var(--color-navy);
  padding: clamp(0.75rem, 2vw, 1.25rem);
}

/* Above the mobile breakpoint, every pair is placed explicitly (not left to
   grid auto-placement, which leaves gaps once some items get a fixed column):
   4 columns, one photo+caption pair stacked per column, alternating which
   one sits on top so the row reads photo/text/photo/text on top and
   text/photo/text/photo underneath. Below the breakpoint .galleria__grid
   above stays a plain single column so photo and caption always stack in
   document order. */
@media (min-width: 641px) {
  .galleria__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(14rem, 1fr));
  }

  .galleria__item:nth-of-type(1) { grid-row: 1; grid-column: 1; }
  .galleria__note:nth-of-type(1) { grid-row: 2; grid-column: 1; }
  .galleria__note:nth-of-type(2) { grid-row: 1; grid-column: 2; }
  .galleria__item:nth-of-type(2) { grid-row: 2; grid-column: 2; }
  .galleria__item:nth-of-type(3) { grid-row: 1; grid-column: 3; }
  .galleria__note:nth-of-type(3) { grid-row: 2; grid-column: 3; }
  .galleria__note:nth-of-type(4) { grid-row: 1; grid-column: 4; }
  .galleria__item:nth-of-type(4) { grid-row: 2; grid-column: 4; }
}

.galleria__item {
  border-radius: 0;
  overflow: hidden;
  min-height: 0;
  background: var(--color-rule); /* placeholder while image loads */
}

.galleria__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transform: scale(var(--image-scale, 1));
  transform-origin: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transition:
    transform 560ms var(--ease-out-quart),
    filter 400ms var(--ease-out-quart);
}

.galleria__item:hover img {
  transform: scale(calc(var(--image-scale, 1) * 1.04));
  filter: brightness(0.85) saturate(1.1);
}

.galleria__note {
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: var(--color-bg);
  color: var(--color-navy);
  font-family: var(--font-heading);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  max-width: none;
}

@media (max-width: 640px) {
  .galleria__grid {
    gap: 1px;
    padding: 1px;
  }
  .galleria__item {
    min-height: 240px;
  }
}

/* --- Me teimme sen (referenssit) ------------------------------------ */
.referenssit {
  background: var(--color-bg);
  padding-block: var(--pad-y);
}

.referenssit__header {
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.referenssit__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}

.referenssit__window {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-rule); /* placeholder while media loads */
  margin: 0;
}

.referenssit__window img,
.referenssit__window video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transform: scale(var(--image-scale, 1));
  transform-origin: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transition: transform 560ms var(--ease-out-quart);
}

.referenssit__item:hover .referenssit__window img,
.referenssit__item:hover .referenssit__window video {
  transform: scale(calc(var(--image-scale, 1) * 1.04));
}

.referenssit__story {
  margin-top: 1rem;
  color: var(--color-navy);
  font-size: 1rem;
  line-height: 1.55;
  max-width: none;
}

/* --- Kausi ---------------------------------------------------------- */
.kausi {
  background: var(--color-bg);
  padding-block: var(--pad-y);
}

.kausi__header {
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.kausi__header p {
  color: var(--color-muted);
  margin-top: 0.75rem;
  font-size: 1.05rem;
}

.kausi__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.kausi-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 2.25rem;
  border-top: 3px solid var(--color-brand);
}

.kausi-card__season {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.6rem;
}

.kausi-card h3 {
  margin-bottom: 0.85rem;
  font-size: 1.2rem;
}

.kausi-card p {
  font-size: 0.95rem;
  color: var(--color-ink);
}

/* --- Jäätelövene ---------------------------------------------------- */
.jaatelö {
  background: var(--color-navy);
  padding-block: var(--pad-y);
  overflow: hidden;
  position: relative;
}

/* Subtle wave texture */
.jaatelö::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to right,
    var(--color-brand) 0%,
    var(--color-warm-tree) 50%,
    var(--color-brand) 100%
  );
  opacity: 0.6;
}

.jaatelö__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.jaatelö__eyebrow {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-warm-tree);
  margin-bottom: 1.25rem;
  display: block;
}

.jaatelö__text h2 {
  color: var(--color-white);
  margin-bottom: 1.25rem;
}

.jaatelö__text p {
  color: oklch(0.780 0.020 228);
  margin-bottom: 1rem;
  font-size: 1.02rem;
}

.jaatelö__text .btn-primary {
  margin-top: 0.5rem;
}

.jaatelö__image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 20px 60px oklch(0.100 0.040 235 / 0.5);
}

.jaatelö__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  object-position: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transform: scale(var(--image-scale, 1));
  transform-origin: var(--image-position-x, 50%) var(--image-position-y, 50%);
}

@media (max-width: 760px) {
  .jaatelö__inner {
    grid-template-columns: 1fr;
  }
  .jaatelö__image {
    order: -1;
    max-height: 280px;
    border-radius: var(--radius-md);
  }
}

/* --- Yhteystiedot --------------------------------------------------- */
.yhteystiedot {
  background: var(--color-surface);
  padding-block: var(--pad-y);
}

.yhteystiedot__header {
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.yhteystiedot__header h2 {
  margin-bottom: 0.75rem;
}

.yhteystiedot__intro {
  color: var(--color-muted);
  font-size: 1.05rem;
  max-width: 58ch;
}

.yhteystiedot__layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

@media (max-width: 860px) {
  .yhteystiedot__layout {
    grid-template-columns: 1fr;
  }
}

/* Form */
/* [hidden] alone loses to the display:flex below (author rules outrank the
   UA [hidden] default), so form.hidden = true would leave the form visibly
   laid out next to the success message without this override. */
.yhteyslomake[hidden] {
  display: none;
}

.yhteyslomake {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-navy);
  letter-spacing: 0.01em;
}

.form-group label .req {
  color: var(--color-brand);
  margin-left: 0.15em;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition:
    border-color var(--dur-fast) var(--ease-out-quart),
    box-shadow var(--dur-fast) var(--ease-out-quart);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: oklch(0.640 0.010 228);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px oklch(0.560 0.105 228 / 0.14);
}

.form-group input[type="file"] {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-hint {
  font-size: 0.80rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.field-error {
  border-color: oklch(0.540 0.180 25) !important;
  box-shadow: 0 0 0 3px oklch(0.540 0.180 25 / 0.14) !important;
}

.form-submit {
  align-self: flex-start;
  margin-top: 0.5rem;
}

/* [hidden] alone loses to the display:flex below (author rules outrank the
   UA [hidden] default) — without this override both boxes stayed visible
   on every page load, submitted or not. */
.form-success[hidden],
.form-error[hidden] {
  display: none;
}

.form-success {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: oklch(0.960 0.040 150);
  border: 1px solid oklch(0.760 0.120 150);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-top: 1rem;
}

.form-success__icon {
  font-size: 1.5rem;
  line-height: 1;
  color: oklch(0.380 0.140 150);
  flex-shrink: 0;
  margin-top: 0.1em;
}

.form-success p {
  color: oklch(0.220 0.080 150);
  font-size: 1rem;
  line-height: 1.6;
  max-width: none;
}

.form-honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: oklch(0.960 0.045 25);
  border: 1px solid oklch(0.720 0.140 25);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-top: 1rem;
}

.form-error__icon {
  font-size: 1.5rem;
  line-height: 1;
  color: oklch(0.460 0.170 25);
  flex-shrink: 0;
  margin-top: 0.1em;
}

.form-error p {
  color: oklch(0.280 0.110 25);
  font-size: 1rem;
  line-height: 1.6;
  max-width: none;
}

/* Contact aside */
.yhteystiedot__info {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-block {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-rule);
}

.info-block:first-child {
  padding-top: 0;
}

.info-block:last-child {
  border-bottom: none;
}

.info-block__label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.4rem;
}

.info-block a {
  color: var(--color-navy);
  font-weight: 600;
  font-size: 1rem;
  transition: color var(--dur-fast);
  display: block;
  margin-bottom: 0.1rem;
}

.info-block a:hover {
  color: var(--color-brand);
}

.info-block address {
  font-style: normal;
  color: var(--color-ink);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* --- Footer --------------------------------------------------------- */
.footer {
  background: var(--color-navy);
  color: var(--color-white);
}

.footer::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--color-oak), var(--color-mahogany));
}

.footer .container {
  padding-block: 2.5rem;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  padding-bottom: 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid oklch(1.000 0.000 0 / 0.10);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer__name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-white);
}

.footer__address,
.footer__ytunnus {
  font-size: 0.85rem;
  color: oklch(1.000 0.000 0 / 0.50);
}

.footer__links {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.footer__links a {
  font-size: 0.88rem;
  color: oklch(1.000 0.000 0 / 0.60);
  transition: color var(--dur-fast);
}

.footer__links a:hover {
  color: var(--color-white);
}

.footer__copy {
  font-size: 0.78rem;
  color: oklch(1.000 0.000 0 / 0.30);
}

/* --- Theme toggle --------------------------------------------------- */
.navbar__theme {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px;
  border-radius: 50%;
  color: oklch(1.000 0.000 0 / 0.80);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.navbar__theme:hover {
  background: oklch(1.000 0.000 0 / 0.12);
}

.navbar.scrolled .navbar__theme {
  color: var(--color-navy);
}

.navbar.scrolled .navbar__theme:hover {
  background: oklch(0.220 0.060 235 / 0.08);
}

/* Show sun in light mode, moon in dark mode */
.navbar__theme-icon--moon { display: none; }
[data-theme="dark"] .navbar__theme-icon--sun  { display: none; }
[data-theme="dark"] .navbar__theme-icon--moon { display: block; }

/* On mobile: links hidden, theme button takes auto margin to push right */
@media (max-width: 760px) {
  .navbar__theme { margin-left: auto; }
}

/* --- Palvelu card icon ---------------------------------------------- */
.palvelu-card__icon {
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1rem;
  color: var(--color-brand);
  position: relative;
}

.palvelu-card__icon::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.6rem;
  width: 2.25rem;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-oak), var(--color-mahogany));
}

.palvelu-card__icon svg {
  width: 100%;
  height: 100%;
}

.palvelu-card__icon-img {
  display: block;
  width: 100%;
  height: 100%;
  background-color: currentColor;
  -webkit-mask: var(--icon-src) center / contain no-repeat;
  mask: var(--icon-src) center / contain no-repeat;
}

/* --- Jäätelö icon ---------------------------------------------------- */
.jaatelö__icon {
  width: 3.25rem;
  height: 3.25rem;
  color: var(--color-warm-tree);
  margin-bottom: 1.5rem;
}

.jaatelö__icon svg {
  width: 100%;
  height: 100%;
}

.jaatelö__icon-img {
  display: block;
  width: 100%;
  height: 100%;
  background-color: currentColor;
  -webkit-mask: var(--icon-src) center / contain no-repeat;
  mask: var(--icon-src) center / contain no-repeat;
}

/* --- Yhteystiedot logo + map ---------------------------------------- */
.yhteystiedot__logo {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--color-rule);
}

.yhteystiedot__logo img {
  max-width: 160px;
  height: auto;
}

.editor-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 1.25rem;
  color: var(--color-muted);
  border: 1px solid var(--color-rule);
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}

.editor-link:hover {
  opacity: 1;
  color: var(--color-brand);
  border-color: var(--color-brand);
}

.editor-link--footer {
  width: 32px;
  height: 32px;
  margin-bottom: 0;
  color: oklch(1.000 0.000 0 / 0.55);
  border-color: oklch(1.000 0.000 0 / 0.25);
}

.editor-link--footer:hover {
  color: var(--color-white);
  border-color: oklch(1.000 0.000 0 / 0.55);
}

/* --- Tervetuloa telakalle — map + quote ------------------------------ */
.telakalle {
  position: relative;
  background: var(--color-brand);
  overflow: hidden;
}

.telakalle__map {
  position: relative;
  width: 100%;
  aspect-ratio: 2966 / 1333; /* matches map-logo-compass.png so nothing is cropped off the sides */
  min-height: 200px;
  background: var(--color-rule);
  overflow: hidden;
}

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

.telakalle__map-caption {
  position: absolute;
  left: 1rem;
  top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  background: oklch(1.000 0.000 0 / 0.88);
  box-shadow: var(--shadow-card);
}

.telakalle__map-icon {
  flex-shrink: 0;
}

.telakalle__map-label {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-navy);
}

.telakalle__inner {
  padding-block: 0 clamp(3rem, 6vw, 4.5rem);
}

.telakalle__inner h2 {
  color: var(--color-white);
  padding-top: clamp(2rem, 4vw, 3rem);
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.telakalle__quote {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2rem);
  max-width: 640px;
}

.telakalle__avatar {
  flex-shrink: 0;
  overflow: hidden;
  width: clamp(5.5rem, 9vw, 7.5rem);
  height: clamp(5.5rem, 9vw, 7.5rem);
  border-radius: 50%;
  background: oklch(0.220 0.055 232); /* fixed dark navy fill — same in both themes, unlike --color-navy which inverts */
  border: 3px solid var(--color-warm-tree);
  box-shadow: var(--shadow-card-hover);
}

.telakalle__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--image-position-x, 50%) var(--image-position-y, 50%);
  transform: scale(var(--image-scale, 1));
  transform-origin: var(--image-position-x, 50%) var(--image-position-y, 50%);
}

.telakalle__card {
  position: relative;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-card-hover);
}

.telakalle__mark {
  display: block;
  font-family: var(--font-heading);
  font-size: 2.75rem;
  line-height: 1;
  color: var(--color-brand);
  opacity: 0.35;
  margin-bottom: 0.25rem;
}

.telakalle__text {
  color: var(--color-navy);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.4;
  max-width: none;
}

.telakalle__author {
  margin-top: 0.85rem;
  font-size: 0.88rem;
  color: var(--color-muted);
}

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

@media (max-width: 560px) {
  .telakalle__quote {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --- Dark theme ---------------------------------------------------- */
[data-theme="dark"] {
  --color-bg:      oklch(0.148 0.042 232);
  --color-surface: oklch(0.192 0.050 230);
  --color-navy:    oklch(0.900 0.010 228);
  --color-brand:   oklch(0.680 0.115 228);
  --color-warm-tree:   oklch(0.750 0.128 73);
  --color-ink:     oklch(0.860 0.012 228);
  --color-muted:   oklch(0.680 0.022 228);
  --color-white:   oklch(0.960 0.008 228);
  --color-rule:    oklch(0.270 0.040 232);
  --color-navbar-scrolled: oklch(0.148 0.042 232 / 0.94);      /* navbar background scrolled (dark theme) */
  --color-wave:    134 184 214;                                /* brighter wave fill for contrast against the near-black dark-theme hero */
  --color-palvelut-bg: oklch(0.170 0.048 230);                 /* pale-blue section tint, dark-theme equivalent */
  --shadow-card:       0 1px 6px oklch(0 0 0 / 0.35);
  --shadow-card-hover: 0 8px 28px oklch(0 0 0 / 0.50);
}

[data-theme="dark"] .hero {
  background: oklch(0.110 0.038 234);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
  background: oklch(0.192 0.050 230);
  border-color: var(--color-rule);
  color: var(--color-ink);
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
  color: oklch(0.520 0.025 228);
}

[data-theme="dark"] .telakalle__map {
  background: oklch(0.220 0.055 232);
}

[data-theme="dark"] .footer {
  background: oklch(0.108 0.038 234);
}
