/* ==========================================================================
   Shared conventions for all module-blocks
   Color tokens, background helpers, and the button-with-arrow pattern.
   Enqueued unconditionally via enqueue_block_assets in module-blocks.php.
   ========================================================================== */

:root {
  --mb-orange: #ff7d00;
  --mb-blue:   #0a64c8;
  --mb-black:  #000000;
}

.mb-bg-orange { background-color: var(--mb-orange); color: #fff; }
.mb-bg-blue   { background-color: var(--mb-blue);   color: #fff; }
.mb-bg-black  { background-color: var(--mb-black);  color: #fff; }
.mb-bg-none   { background-color: transparent;      color: inherit; }

/* White text on colored backgrounds.
   Headings and links must be targeted by tag with descendant selectors —
   the theme sets explicit colors on them that beat plain inheritance.
   This grouped form (no :where()) carries enough specificity to win.
   VERIFY during Milestone 1: if Kadence still overrides any element here,
   add !important to that declaration and note it back. Do not silently
   leave theme colors winning on a colored block. */
.mb-bg-orange h1, .mb-bg-orange h2, .mb-bg-orange h3, .mb-bg-orange h4, .mb-bg-orange h5, .mb-bg-orange h6,
.mb-bg-orange p, .mb-bg-orange li, .mb-bg-orange a, .mb-bg-orange strong,
.mb-bg-blue h1, .mb-bg-blue h2, .mb-bg-blue h3, .mb-bg-blue h4, .mb-bg-blue h5, .mb-bg-blue h6,
.mb-bg-blue p, .mb-bg-blue li, .mb-bg-blue a, .mb-bg-blue strong,
.mb-bg-black h1, .mb-bg-black h2, .mb-bg-black h3, .mb-bg-black h4, .mb-bg-black h5, .mb-bg-black h6,
.mb-bg-black p, .mb-bg-black li, .mb-bg-black a, .mb-bg-black strong {
  color: #fff;
}

/* Shared block padding utility. New blocks apply .mb-block to their wrapper
   instead of redefining padding (see Phase 2 §1.4). */
.mb-block {
  padding: 3rem 1rem;
}
@media (max-width: 768px) {
  .mb-block {
    padding: 2rem 1rem;
  }
}

/* Shared button-with-arrow pattern.
   The L-shaped arrow is a CSS ::before clip-path on the wrapper class — no
   inline SVG. Drawn on currentColor so it inherits text color (white on a
   colored bg via the shared rule, theme default otherwise). Works on both an
   <a> (button partial) and a <span> (Latest Articles card). */
.mb-btn-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: inherit; /* white on colored bg via shared rule, theme default otherwise */
}
.mb-btn-arrow::before {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
  width: clamp(2rem, 2vw, 2.875rem);
  height: clamp(1.2rem, 2.5vw, 2rem);
  /* L-arrow: vertical bar (left) + horizontal stroke + arrowhead pinned to the
     right edge via calc(100% - …) so it rides the edge as the width grows. */
  clip-path: polygon(
    0px 0%,
    2px 0%,
    2px 72%,
    calc(100% - 8px) 72%,
    calc(100% - 8px) 48%,
    100% calc(72% + 1px),
    calc(100% - 8px) 100%,
    calc(100% - 8px) calc(72% + 2px),
    0px calc(72% + 2px)
  );
  /* Vertical alignment via flex centering + a single tunable nudge var
     (set e.g. -2px if the arrow rides slightly high against the cap height). */
  transform: translateY(var(--mb-arrow-nudge-y, -4px));
}
@media (prefers-reduced-motion: no-preference) {
  .mb-btn-arrow::before { transition: width 0.4s ease-in-out; }
  .mb-btn-arrow:hover::before { width: clamp(3rem, 3vw, 4rem); }
}

/* Shared upright (diagonal ↗) arrow — STATIC (no hover), used only on Products
   card titles. CSS ::after clip-path on currentColor, so it goes white on a
   colored Products background automatically via the shared rule. */
.mb-upright-arrow {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.mb-upright-arrow::after {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
  width: clamp(2rem, 2vw, 2.875rem);
  height: 1.5rem;
  /* Diagonal ↗: horizontal tail + arrowhead at the upper-right. */
  clip-path: polygon(
    0px calc(50% + 1px),
    calc(100% - 19px) calc(50% + 1px),
    calc(100% - 11px) 4px,
    calc(100% - 9px) 7px,
    calc(100% - 8px) 0px,
    calc(100% - 15px) 1px,
    calc(100% - 12px) 3px,
    calc(100% - 20px) calc(50% - 1px),
    0px calc(50% - 1px)
  );
  /* Static placement nudge — single tunable var, not a hardcoded transform. */
  transform: translate(var(--mb-upright-nudge-x, 8px), var(--mb-upright-nudge-y, 0));
}

/* ==========================================================================
   Footer menus (Phase 5, Milestone 3).
   Presentation for the [module_menu] output that sits in the Kadence "Replace
   Footer" Hooked Element. Flat lists; the black background, columns, and white
   text live in the Element itself (links inherit its color). This is footer
   chrome — could equally live in theme CSS; kept here since shared.css already
   loads site-wide on the front end.
   ========================================================================== */
.footer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-menu li {
  margin: 0 0 0.5rem;
}
.footer-menu a {
  text-decoration: none;
  color: #fff;
}
.footer-menu a:hover {
  text-decoration: underline;
}

.module-footer-text {
  color: #fff;
}

.module-footer-text--company {
  font-weight: bold;
}

/* ==========================================================================
   Language switcher (Phase 5, Milestone 4) — starting point, tune to design.
   Output by [module_lang_switcher] (desktop dropdown) and
   [module_lang_switcher_flat] (mobile flat row) placed in Kadence header HTML
   elements. Uses Polylang's stable .current-lang class; colors inherit from
   the header (currentColor), so it works on light or dark header bars.
   ========================================================================== */

/* --- Desktop: trigger (globe + current code) opens to the other languages. */
.module-lang-switcher--dropdown {
  position: relative;
  display: inline-block;
}
.module-lang-switcher__current {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
/* Globe icon via mask so it follows currentColor. Placeholder glyph — swap the
   data-URI for the final globe if the design differs. */
.module-lang-switcher__current::before {
  content: "";
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='3' y1='12' x2='21' y2='12'/%3E%3Cpath d='M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='3' y1='12' x2='21' y2='12'/%3E%3Cpath d='M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.module-lang-switcher__list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  display: none;
  min-width: 4rem;
  background: #fff;
  color: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.module-lang-switcher--dropdown:hover .module-lang-switcher__list,
.module-lang-switcher--dropdown:focus-within .module-lang-switcher__list {
  display: block;
}
.module-lang-switcher__list a {
  display: block;
  padding: 0.25rem 0.75rem;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}
.module-lang-switcher__list a:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* --- Mobile / off-canvas: flat horizontal row of all codes. ---------------- */
.module-lang-switcher--flat ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.module-lang-switcher--flat a {
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
}
.module-lang-switcher--flat .current-lang a,
.module-lang-switcher--flat .current-lang {
  font-weight: 700; /* mark the active language */
}

/* ==========================================================================
   Header CTA 
   ========================================================================== */
.mb-header-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  text-transform: uppercase;
  font-size:1rem;
  font-weight: 500;
  letter-spacing: 0;
  color: inherit; /* follows header text color (works on light or dark bar) */
  padding-right: var(--mb-header-cta-pad, 2.6rem); /* reserves space for the arrow */
}
.mb-header-cta::after {
  content: "";
  position: absolute;
  right: 0;
  top: 66%;
  transform: translateY(calc(-50% + var(--mb-header-arrow-nudge-y, 0px)));
  width: var(--mb-header-cta-arrow-w, 2.2rem);
  height: 22px;
  background: currentColor;
  clip-path: polygon(
    0 0,
    12px 0,
    12px 10px,
    calc(100% - 10px) 10px,
    calc(100% - 10px) 6px,
    100% 11px,
    calc(100% - 10px) 16px,
    calc(100% - 10px) 12px,
    10px 12px,
    10px 2px,
    0 2px
  );
}
@media (prefers-reduced-motion: no-preference) {
  .mb-header-cta { transition: padding-right 0.4s ease-in-out; }
  .mb-header-cta::after { transition: width 0.4s ease-in-out; }
  .mb-header-cta:hover { --mb-header-cta-pad: 3.8rem; }
  .mb-header-cta:hover::after { --mb-header-cta-arrow-w: 3.2rem; }
}

/* Divider between two adjacent CTAs in HTML 2 ("Vuokraa Module | Pyydä tarjous").
   Desktop only — removed and stacked on the mobile header below. */
.mb-header-cta + .mb-header-cta {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid currentColor;
}

/* Mobile header (below 1200px): stack the CTAs, drop the pipe divider, and use
   the standard L-arrow ::before (left of label) instead of the stepped ::after. */
@media (max-width: 1199px) {
  .mb-header-cta {
    display: flex;
    width: fit-content;
    margin-top: 2rem;
    padding-right: 0; /* no stepped ::after to reserve space for */
    gap: 0.8rem;      /* space between the L-arrow and the label */
  }
  .mb-header-cta::after {
    display: none; /* remove the stepped arrow */
  }
  /* Standard L-arrow, same as .mb-btn-arrow::before. */
  .mb-header-cta::before {
    content: "";
    display: inline-block;
    flex-shrink: 0;
    background: currentColor;
    width: clamp(2rem, 2vw, 2.875rem);
    height: clamp(1.2rem, 2.5vw, 2rem);
    clip-path: polygon(
      0px 0%,
      2px 0%,
      2px 72%,
      calc(100% - 8px) 72%,
      calc(100% - 8px) 48%,
      100% calc(72% + 1px),
      calc(100% - 8px) 100%,
      calc(100% - 8px) calc(72% + 2px),
      0px calc(72% + 2px)
    );
    transform: translateY(var(--mb-arrow-nudge-y, -4px));
  }
  .mb-header-cta + .mb-header-cta {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
}

/* L-arrow grow-on-hover for the mobile header CTA (parity with .mb-btn-arrow). */
@media (max-width: 1199px) and (prefers-reduced-motion: no-preference) {
  .mb-header-cta::before { transition: width 0.4s ease-in-out; }
  .mb-header-cta:hover::before { width: clamp(3rem, 3vw, 4rem); }
}