/* Flow style: the VTMI look (off-white page, rounded panels, large tight headings)
   plus sections that come in as you scroll. Active on pages whose <body> has the class "flow-style".
   Animations only run when flow.js adds "flow-js" to <html>; without it, everything is visible. */

/* ---------- Tokens (same palette as the VTMI page) ---------- */
.flow-style {
  --flow-bg: #faf9f5;
  --flow-panel: #f1f0ec;
  --flow-panel-dark: #0e0e0e;
  --flow-ink: #111111;
  --flow-muted: #6b6b66;
  --flow-line: #e4e4df;
  --flow-gold: #b8862b;
  --flow-radius: 20px;
  --flow-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  background: var(--flow-bg);
}

/* ---------- Home hero: balanced group, one main button, text links below ---------- */
/* Landing hero fills the whole window (svh: phones' browser bars don't cut it off) */
.page-landing header.page-header.h-screen {
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  min-height: 100svh;
}

.page-landing header.page-header .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 3.5vh, 2.75rem);
  min-height: calc(100svh - 120px - 5rem);
}

.page-landing header.page-header h1 {
  margin: 0;
}

.page-landing header.page-header .container > .flex-col {
  gap: 2.25rem !important;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  row-gap: 0.5rem;
}

.page-landing header.page-header a.hero-link {
  position: relative;
  padding: 0.125rem 1.25rem 0.375rem;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: opacity 200ms ease;
}

/* Underline draws in from the left on hover and focus (same movement as the menu links) */
.page-landing header.page-header a.hero-link::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.page-landing header.page-header a.hero-link:is(:hover, :focus-visible)::after {
  transform: scaleX(1);
}

.page-landing header.page-header a.hero-link + a.hero-link {
  border-left: 1px solid rgba(255, 255, 255, 0.55);
}

.hero-links:hover .hero-link:not(:hover) {
  opacity: 0.7;
}

/* Phones: smaller links; if they wrap (longer Finnish labels), a new row starts without a divider */
@media (max-width: 479px) {
  .page-landing header.page-header a.hero-link {
    padding: 0.125rem 0.625rem 0.375rem;
    font-size: 0.9375rem;
    white-space: nowrap;
  }
  .page-landing header.page-header a.hero-link::after {
    left: 0.625rem;
    right: 0.625rem;
  }
}

.page-landing header.page-header a.hero-link.is-row-start {
  border-left-color: transparent !important;
}

/* Hero photo: covers the hero, but is never drawn wider than 1620px (125% of the 1297px photo), so it
   does not turn blurry on large screens. 150svh = the width a 3:2 photo needs to cover a full-height hero.
   Slightly oversized (110vw); --hero-dx moves the gold bars to the right of the headline on desktop. */
.page-landing header.page-header {
  --hero-w: min(max(110vw, 150svh), 1620px);
  --hero-dx: clamp(80px, 13vw, 340px);
  background-color: #000;
  background-repeat: no-repeat;
  background-size: var(--hero-w) auto !important;
  background-position: calc(50% + var(--hero-dx)) center;
}

@media (max-width: 1025px) {
  .page-landing header.page-header { --hero-dx: 0px; }
}

/* With flow.js: the photo is drawn in its own layer with feathered edges, so when the cap leaves black
   around it (wide or tall screens) it fades into the background instead of ending in a hard edge. */
.page-landing header.page-header.hero-masked {
  position: relative;
  isolation: isolate;
  background-image: none !important;
}

.page-landing header.page-header.hero-masked::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: calc((100% - var(--hero-w)) / 2 + var(--hero-dx));
  top: 50%;
  width: var(--hero-w);
  aspect-ratio: 1297 / 865;
  background: var(--hero-img) center / 100% 100% no-repeat;
  transform: translateY(calc(-50% + var(--flow-hero, 0) * 120px));
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
                      linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
              linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
  pointer-events: none;
}

/* ---------- Page canvas ---------- */
.flow-style main {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 24px);
  padding: clamp(24px, 4vw, 56px) clamp(16px, 3vw, 32px) clamp(40px, 6vw, 80px);
}

/* ---------- Sections become panels ---------- */
.flow-style main > section:is(.major-minor, .major-minor-quarter) {
  position: relative;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) !important;
  grid-template-rows: auto !important;
  grid-template-areas: "minor major" !important;
  gap: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  border-radius: var(--flow-radius);
  overflow: hidden;
  background: var(--flow-panel) !important;
  color: var(--flow-ink);
}

.flow-style main > section:is(.major-minor, .major-minor-quarter).minor-last {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) !important;
  grid-template-areas: "major minor" !important;
}

.flow-style main > section:is(.major-minor, .major-minor-quarter) > .minor {
  grid-area: minor !important;
  align-self: stretch !important;
  justify-content: center;
  margin: 0 !important;
  padding: clamp(32px, 5vw, 72px) !important;
  background: transparent !important;
  color: inherit;
}

.flow-style main > section:is(.major-minor, .major-minor-quarter) > .major {
  grid-area: major !important;
  align-self: stretch !important;
  margin: 0 !important;
  min-height: clamp(320px, 38vw, 540px) !important;
  aspect-ratio: auto !important;
  background-color: transparent;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: scroll !important;
}

.flow-style main > section.major-with-content > .major {
  display: flex !important;
  align-items: center !important;
  justify-content: center;
  padding: clamp(20px, 3vw, 40px);
  background: transparent !important;
}

.flow-style main > section.major-with-content > .major > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  min-height: 100%;
  overflow: visible !important; /* blog cards grow on hover; the panel's rounded edge still clips */
}

/* Charts and other content in the picture column use its full width */
.flow-style main > section.major-with-content > .major > div > * {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}

.flow-style main > section.major-with-content > .major figure {
  width: 100%;
  height: auto;
}

/* Dark panel (Voima Account) */
.flow-style main > section.bg-black:is(.major-minor, .major-minor-quarter) {
  background: var(--flow-panel-dark) !important;
  color: #fff;
}

.flow-style main > section.bg-black.major-with-content > .major {
  background: transparent !important;
}

/* Mobile: picture on top, text below */
@media (max-width: 899px) {
  .flow-style main > section:is(.major-minor, .major-minor-quarter),
  .flow-style main > section:is(.major-minor, .major-minor-quarter).minor-last {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "major" "minor" !important;
  }
  .flow-style main > section:is(.major-minor, .major-minor-quarter) > .major {
    min-height: 240px !important;
  }
}

/* ---------- Text panels (no photo, no picture): heading top-left, text with its own padding ---------- */
.flow-style main > section:is(.major-minor, .major-minor-quarter):not(.major-has-background-image):not(.major-with-content) > .minor {
  justify-content: flex-start;
}

.flow-style main > section:is(.major-minor, .major-minor-quarter):not(.major-has-background-image):not(.major-with-content) > .major {
  min-height: 0 !important;
  padding: clamp(32px, 5vw, 72px) !important;
}

@media (min-width: 900px) {
  .flow-style main > section:is(.major-minor, .major-minor-quarter):not(.major-has-background-image):not(.major-with-content):not(.minor-last) > .major {
    padding-left: 0 !important;
  }
  .flow-style main > section:is(.major-minor, .major-minor-quarter).minor-last:not(.major-has-background-image):not(.major-with-content) > .major {
    padding-right: 0 !important;
  }
}

/* Phones: in text panels the heading comes first */
@media (max-width: 899px) {
  .flow-style main > section:is(.major-minor, .major-minor-quarter):not(.major-has-background-image):not(.major-with-content),
  .flow-style main > section:is(.major-minor, .major-minor-quarter).minor-last:not(.major-has-background-image):not(.major-with-content) {
    grid-template-areas: "minor" "major" !important;
  }
  .flow-style main > section:is(.major-minor, .major-minor-quarter):not(.major-has-background-image):not(.major-with-content) > .minor {
    padding-bottom: 0 !important;
  }
}

/* No heavy dividers inside panels; headings align left */
.flow-style main > section:is(.major-minor, .major-minor-quarter) > :is(.minor, .major) {
  border: 0 !important;
}

.flow-style main > section:is(.major-minor, .major-minor-quarter) h2 {
  text-align: left !important;
}

/* ---------- Other sections (lists, tables, calculators, value blocks) as panels too ---------- */
.flow-style main > section.section-container:not(.major-minor):not(.major-minor-quarter) {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  grid-template-columns: [content] minmax(0, 1fr) !important;
  padding: clamp(32px, 5vw, 64px) clamp(24px, 5vw, 72px) !important;
  border-radius: var(--flow-radius);
}

.flow-style main > section.section-container.bg-dark:not(.major-minor):not(.major-minor-quarter) {
  background: var(--flow-panel) !important;
}

.flow-style main > section.content-hero:not(.screenful) {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  border-radius: var(--flow-radius);
  overflow: hidden;
}

.flow-style main > section.content-hero.bg-dark {
  background: var(--flow-panel) !important;
}

/* ---------- Typography (VTMI scale) ---------- */
.flow-style main > section:is(.major-minor, .major-minor-quarter) h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(30px, 3.4vw, 48px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.flow-style main > section:is(.major-minor, .major-minor-quarter) h2 .preheader {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  color: var(--flow-muted);
}

.flow-style main > section.bg-black h2 .preheader {
  color: rgba(255, 255, 255, 0.65);
}

.flow-style main > section:is(.major-minor, .major-minor-quarter) .minor p,
.flow-style main > section:is(.major-minor, .major-minor-quarter) .minor li {
  font-size: 1.0625rem;
  line-height: 1.6;
}

.flow-style main > section:is(.major-minor, .major-minor-quarter) .minor > *:last-child {
  margin-bottom: 0;
}

/* ---------- Closing image banner (store) as a panel ---------- */
.flow-style main > section.content-hero.screenful {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  min-height: clamp(320px, 42vw, 480px);
  border-radius: var(--flow-radius);
  overflow: hidden;
}

/* ---------- Interaction ---------- */
.flow-style main > section:is(.major-minor, .major-minor-quarter) > .major,
.flow-style main > section:is(.major-minor, .major-minor-quarter) > .major img {
  transition: transform 900ms var(--flow-ease);
}

/* Hover: only photos zoom slightly; text and charts never move. Blog cards grow on their own. */
@media (hover: hover) {
  .flow-style main > section.major-has-background-image:hover > .major {
    transform: scale(1.025);
  }
}

.flow-style .post-card:is(:hover, :focus-within) {
  transform: scale(1.02);
}

/* Scroll progress: a thin gold line under the notice bar */
.flow-progress {
  position: fixed;
  top: 120px;
  left: 0;
  right: 0;
  z-index: 11;
  height: 3px;
  background: var(--flow-gold, #b8862b);
  transform: scaleX(var(--flow-progress, 0));
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Scroll-in animation (only with flow.js) ----------
   Panels fade in; only photos open up. Text, headings and charts stay still. */
.flow-js .flow-style main > section {
  opacity: 0;
  transition: opacity 800ms var(--flow-ease);
}

.flow-js .flow-style main > section.major-has-background-image > .major {
  clip-path: inset(8% 8% 8% 8% round 16px);
  transition: clip-path 1100ms var(--flow-ease), transform 900ms var(--flow-ease);
}

.flow-js .flow-style main > section.is-in {
  opacity: 1;
}

.flow-js .flow-style main > section.is-in.major-has-background-image > .major {
  clip-path: inset(0 0 0 0 round 0);
}

/* Hero: the photo drifts slower than the page and the content fades as you scroll past */
.flow-js .flow-style header.page-header {
  background-position: calc(50% + var(--hero-dx, 0px)) calc(50% + var(--flow-hero, 0) * 120px);
}

.flow-js .flow-style header.page-header .container {
  opacity: calc(1 - var(--flow-hero, 0) * 1.4);
}

@media (prefers-reduced-motion: reduce) {
  .flow-progress { display: none; }
  .page-landing header.page-header a.hero-link::after { transition: none; }
  .flow-style main > section:is(.major-minor, .major-minor-quarter) > .major,
  .flow-style main > section:is(.major-minor, .major-minor-quarter) > .major img { transition: none; }
  .flow-style main > section:hover > .major,
  .flow-style .post-card:is(:hover, :focus-within) { transform: none !important; }
}
