/*
Theme Name: sisustusmiehet theme
Theme URI:
Author: Räikee Oy
Author URI:
Description: A modern agency starter theme built with block editor patterns and theme.json.
Version: 1.6.3
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sisustusmiehet-theme
Tags: block-patterns, block-styles, full-site-editing, wide-blocks
*/

/* ==========================================================================
   Layer Declarations
   ========================================================================== */

/*
   Cascade layers ensure predictable specificity. Layers are applied in order:

   1. reset     — Browser resets + box-sizing normalization (in this file)
   2. wpglobal  — WordPress global styles (auto-wrapped via functions.php for cascade control)
   3. base      — Global element defaults (in this file)
   4. tokens    — Design system tokens via CSS custom properties (in this file)
   5. header    — Header/navigation styles (see assets/css/header.css)
   6. components — Reusable component styles (see styles/blocks/core/*.css)
   7. utilities — Helper & utility classes (in this file)
   8. overrides — High-specificity client overrides (add your custom CSS here)

   Note: reset, base, tokens, and utilities are defined in this file.
   wpglobal layer wraps WP's global-styles-inline-css to make it overridable by other layers.
   header styles live in assets/css/header.css (enqueued via functions.php).
   Block-specific CSS lives in styles/blocks/core/ (auto-enqueued via functions.php).
*/

/* Layer order is also declared early in functions.php (wp_head priority 1) to ensure
   wpglobal is positioned correctly before WordPress outputs global-styles-inline-css.
   If you change this order, update functions.php to match.

   wpglobal is the @layer wrapper for WP's global-styles-inline-css (see functions.php
   wp_print_styles hook). Because it's named and positioned early, any layer declared
   after it (base → overrides) can override WP layout rules — including .is-layout-flow
   blockGap margins — without !important. */
@layer reset, wpglobal, base, tokens, header, components, utilities, overrides;

/* ==========================================================================
   Reset
   ========================================================================== */

@layer reset {
  /* 1. Use a more-intuitive box-sizing model + 2. Remove default margin */
  * {
    box-sizing: border-box;

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

    &:not(dialog) {
      margin: 0;
    }

  }

  /* 3. Enable keyword animations + 4. Accessible line-height + 5. Text rendering */
  html {
    @media (prefers-reduced-motion: no-preference) {
      interpolate-size: allow-keywords;
    }
  }

  body {
    line-height: var(--wp--custom--line-height--normal, 1.5);
    -webkit-font-smoothing: antialiased;
  }

  /* 6. Improve media defaults */
  :is(img, picture, video, canvas, svg) {
    display: block;
    max-inline-size: 100%;
  }

  /* 7. Inherit fonts for form controls */
  :is(input, button, textarea, select) {
    font: inherit;
  }

  /* 8. Avoid text overflows + 9. Improve line wrapping */
  :is(p, h1, h2, h3, h4, h5, h6) {
    overflow-wrap: break-word;
  }

  p {
    text-wrap: pretty;
  }

  :is(h1, h2, h3, h4, h5, h6) {
    text-wrap: balance;
  }

  /* 10. Create a root stacking context */
  :is(#root, #__next) {
    isolation: isolate;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

@layer base {
  :where(a) {
    color: inherit;
  }

  :where(ul, ol) {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  /* Flow/constrained layout spacing — override wpglobal blockGap defaults.
     WP applies margin-block-start to ALL layout children (both .is-layout-flow and
     .is-layout-constrained). We restore spacing only for content-level elements so
     container blocks (group, cover, columns, template-part) stay at 0.

     Covers both block editor classes (.wp-block-*) and plain HTML elements —
     post content outputs bare <p>/<blockquote> etc. with no block class.
     Excludes :first-child to avoid unwanted top margin at the start of a container. */
  :is(.is-layout-flow, .is-layout-constrained)
    > :where(
      p,
      h1,
      h2,
      h3,
      h4,
      h5,
      h6,
      blockquote,
      ul,
      ol,
      figure,
      hr,
      .wp-block-paragraph,
      .wp-block-heading,
      .wp-block-list,
      .wp-block-quote,
      .wp-block-pullquote,
      .wp-block-image,
      .wp-block-gallery,
      .wp-block-buttons,
      .wp-block-table,
      .wp-block-separator
    ):not(:first-child) {
    margin-block-start: var(--wp--preset--spacing--40);
  }

  /* Skip link — visible on focus only */
  .skip-link {
    position: absolute;
    inset-inline-start: -9999px;
    z-index: var(--wp--custom--z-index--toast, 400);
    padding-block: 0.5em;
    padding-inline: 1em;
    background: var(--wp--preset--color--contrast, #0f172a);
    color: var(--wp--preset--color--base, #fff);
    text-decoration: none;
    font-weight: 700;

    &:focus {
      inset-inline-start: 0;
      inset-block-start: 0;
    }
  }
}

/* ==========================================================================
   Tokens — Derived colors & semantic aliases via CSS Relative Colors (RCS)
   All values here are derived from theme.json palette entries using oklch()
   relative color syntax. Swapping hex values in theme.json auto-propagates.
   ========================================================================== */

/*
   QUICK REFERENCE — CSS Custom Properties (All Sources)
   ================================================

   COLOR PALETTE (from theme.json)
   —— Preset colors (use in blocks):
   --wp--preset--color--{primary, accent, secondary, base, contrast, subtle, muted}

   —— Derived states (hover, active, subtle, alpha scales):
   --color-{primary,accent,secondary}-hover           (lighten +15%)
   --color-{primary,accent,secondary}-active          (darken -15%)
   --color-{primary,accent}-subtle                    (light tint, 50% alpha)
   --color-{primary,accent,base,contrast}-alpha-{10,20,50,80}  (transparency scales)

   —— Status colors (contextual messages):
   --color-{success,warning,error,info}              (main color)
   --color-{success,warning,error,info}-subtle       (light variant)

   SEMANTIC SURFACES
   --color-surface                 (card backgrounds)
   --color-surface-raised          (slightly elevated)
   --color-surface-overlay         (semi-transparent overlay)
   --color-surface-sunken          (indented area)
   --color-surface-scrim           (semi-transparent dark layer)

   BORDERS & FOCUS
   --color-border                  (subtle dividers)
   --color-border-strong           (prominent dividers)
   --color-border-interactive      (interactive elements)
   --focus-ring                    (2px solid primary color)
   --focus-ring-offset             (2px)

   Z-INDEX (from theme.json — keep minimal)
   --wp--custom--z-index--sticky   (200 — header)
   --wp--custom--z-index--dropdown (300 — menus)
   --wp--custom--z-index--overlay  (250 — overlays)
   --wp--custom--z-index--modal    (300 — modals)
   --wp--custom--z-index--toast    (400 — notifications)

   TRANSITIONS (from theme.json — use timing + easing separately for flexibility)
   --wp--custom--transition--fast  (150ms ease — shorthand, use for simple transitions)
   --wp--custom--transition--normal (300ms ease — shorthand, use for simple transitions)
   --wp--custom--transition--slow  (500ms ease — shorthand, use for simple transitions)

   TIMING (compose with easing for complex multi-property transitions)
   --wp--custom--timing--fast      (150ms)
   --wp--custom--timing--normal    (300ms)
   --wp--custom--timing--slow      (500ms)

   EASING (use with timing for granular control)
   --wp--custom--easing--standard  (ease — standard, smooth)
   --wp--custom--easing--in        (ease-in — slow start)
   --wp--custom--easing--out       (ease-out — slow end)
   --wp--custom--easing--inOut     (cubic-bezier custom — smooth both ends)

   TYPOGRAPHY (from theme.json)
   --wp--preset--font-family--{heading, body}
   --wp--preset--font-size--{small, medium, large, x-large, 2x-large, 3x-large, 4x-large}
   --wp--custom--line-height--{tight, normal, relaxed}
   --wp--custom--letter-spacing--{tight, normal, wide}

   SPACING (from theme.json, increments 10–100)
   --wp--preset--spacing--{10, 20, 30, 40, 50, 60, 70, 80, 90, 100}

   SHADOWS (from theme.json)
   --wp--preset--shadow--{sm, md, lg, xl, inner}

   BORDER RADIUS (from theme.json)
   --wp--preset--border--radius--{small, medium, large, full}

   LAYOUT (from theme.json)
   --wp--style--global--content-size  (800px — main content width)
   --wp--style--global--wide-size     (1200px — wide section width)

   Note: WordPress preset variables are auto-generated from theme.json.
   Custom theme variables (--wp--custom--*) are defined in theme.json settings.custom.
*/

@layer tokens {
  :root {
    /* ----- Typography size tokens ----- */
    --sz-h3: 2rem;

    /* ----- Primary: hover / active / subtle ----- */
    --color-primary-hover: oklch(
      from var(--wp--preset--color--primary) calc(l + 0.15) c h
    );
    --color-primary-active: oklch(
      from var(--wp--preset--color--primary) calc(l - 0.15) c h
    );
    --color-primary-subtle: oklch(
      from var(--wp--preset--color--primary) calc(l + 0.45) c h / 0.5
    );

    /* ----- Accent: hover / active / subtle ----- */
    --color-accent-hover: oklch(
      from var(--wp--preset--color--accent) calc(l + 0.15) c h
    );
    --color-accent-active: oklch(
      from var(--wp--preset--color--accent) calc(l - 0.15) c h
    );
    --color-accent-subtle: oklch(
      from var(--wp--preset--color--accent) calc(l + 0.45) c h / 0.5
    );

    /* ----- Secondary: hover ----- */
    --color-secondary-hover: oklch(
      from var(--wp--preset--color--secondary) calc(l + 0.15) c h
    );

    /* ----- Primary: transparency scale ----- */
    --color-primary-alpha-10: oklch(
      from var(--wp--preset--color--primary) l c h / 0.1
    );
    --color-primary-alpha-20: oklch(
      from var(--wp--preset--color--primary) l c h / 0.2
    );
    --color-primary-alpha-50: oklch(
      from var(--wp--preset--color--primary) l c h / 0.5
    );

    /* ----- Accent: transparency scale ----- */
    --color-accent-alpha-10: oklch(
      from var(--wp--preset--color--accent) l c h / 0.1
    );
    --color-accent-alpha-20: oklch(
      from var(--wp--preset--color--accent) l c h / 0.2
    );
    --color-accent-alpha-50: oklch(
      from var(--wp--preset--color--accent) l c h / 0.5
    );

    /* ----- Contrast: transparency scale (overlays, borders, scrims) ----- */
    --color-contrast-alpha-5: oklch(
      from var(--wp--preset--color--contrast) l c h / 0.05
    );
    --color-contrast-alpha-10: oklch(
      from var(--wp--preset--color--contrast) l c h / 0.1
    );
    --color-contrast-alpha-20: oklch(
      from var(--wp--preset--color--contrast) l c h / 0.2
    );
    --color-contrast-alpha-50: oklch(
      from var(--wp--preset--color--contrast) l c h / 0.5
    );
    --color-contrast-alpha-80: oklch(
      from var(--wp--preset--color--contrast) l c h / 0.8
    );

    /* ----- Base: transparency scale (light overlays on dark bgs) ----- */
    --color-base-alpha-10: oklch(
      from var(--wp--preset--color--base) l c h / 0.1
    );
    --color-base-alpha-20: oklch(
      from var(--wp--preset--color--base) l c h / 0.2
    );
    --color-base-alpha-50: oklch(
      from var(--wp--preset--color--base) l c h / 0.5
    );

    /* ----- Semantic: surfaces ----- */
    --color-surface: var(--wp--preset--color--base);
    --color-surface-raised: var(--wp--preset--color--subtle);
    --color-surface-overlay: oklch(
      from var(--wp--preset--color--contrast) calc(l - 0.02) c h / 0.97
    );
    --color-surface-sunken: oklch(
      from var(--wp--preset--color--contrast) calc(l - 0.04) c h / 0.94
    );
    --color-surface-scrim: var(--color-contrast-alpha-50);

    /* ----- Semantic: borders ----- */
    --color-border: var(--color-contrast-alpha-10);
    --color-border-strong: var(--color-contrast-alpha-20);
    --color-border-interactive: var(--wp--preset--color--primary);
    --color-border-focus: var(--wp--preset--color--primary);

    /* ----- Semantic: focus ring ----- */
    --color-focus-ring: var(--wp--preset--color--primary);
    --focus-ring: 2px solid var(--color-focus-ring);
    --focus-ring-offset: 2px;

    /* ----- Status: hex fallbacks (overridden to OKLCH below) ----- */
    --color-success: #16a34a;
    --color-warning: #ca8a04;
    --color-error: #dc2626;
    --color-info: #2563eb;
  }

  /* OKLCH enhancement for status colors + derive subtle variants via relative colors */
  @supports (color: oklch(0% 0 0)) {
    :root {
      --color-success: oklch(55% 0.18 150);
      --color-success-subtle: oklch(
        from var(--color-success) calc(l + 0.42) c h
      );
      --color-warning: oklch(70% 0.16 85);
      --color-warning-subtle: oklch(
        from var(--color-warning) calc(l + 0.27) c h
      );
      --color-error: oklch(55% 0.22 28);
      --color-error-subtle: oklch(from var(--color-error) calc(l + 0.42) c h);
      --color-info: oklch(55% 0.2 260);
      --color-info-subtle: oklch(from var(--color-info) calc(l + 0.42) c h);
    }
  }
}

/* ==========================================================================
   Header
   ========================================================================== */

@layer header {
  .wp-block-template-part:has(.site-header) {
    position: fixed;
    inset-block-start: 0;
    inline-size: 100%;
    z-index: var(--wp--custom--z-index--sticky, 200);
  }

  .site-header {
    background: transparent;
    transition: background var(--wp--custom--timing--normal);
  }

  .site-header.is-stuck {
    background: var(--wp--preset--color--base);
    box-shadow: var(--wp--preset--shadow--md);
  }
}

/* ==========================================================================
   Components — Section patterns
   ========================================================================== */

@layer components {

  /* ── Thin rule (separator) ────────────────────────────────────────────── */

  .thin-rule {
    block-size: 1px;
    inline-size: 52px;
    border: none;
    margin-block: var(--wp--preset--spacing--50, 1.5rem);
    background: var(--wp--preset--color--primary);
  }

  /* ── Intro ─────────────────────────────────────────────────────────────── */

  .intro-section {
    .wp-block-columns { margin-bottom: 0 !important; }

    .value-num { white-space: nowrap; flex-shrink: 0; min-inline-size: 2rem; }

    @media (max-width: 768px) {
      .wp-block-columns { flex-direction: column; }

      .intro-left,
      .intro-right {
        border: none !important;
        padding-inline: var(--wp--preset--spacing--50, 1.5rem) !important;
        padding-block: var(--wp--preset--spacing--70, 3rem) !important;
      }
    }
  }

  /* ── Process ───────────────────────────────────────────────────────────── */

  @media (max-width: 768px) {
    .p-step {
      border-right: none !important;
      border-bottom: 1px solid var(--wp--preset--color--muted) !important;
      padding-inline: 0 !important;
      padding-block: var(--wp--preset--spacing--60, 2rem) !important;
    }

    .p-step:last-child {
      border-bottom: none !important;
    }
  }

  /* ── Services ──────────────────────────────────────────────────────────── */

  .services-section {
    .services-list {
      position: relative;
    }

    .service-item {
      position: relative;
      overflow: hidden;

      &::before {
        content: "";
        position: absolute;
        inset-inline-start: calc(-1 * var(--wp--preset--spacing--70, 3.5rem));
        inset-block: 0;
        inline-size: 2px;
        background: var(--wp--preset--color--primary);
        transform: scaleY(0);
        transform-origin: center;
        transition: transform var(--wp--custom--transition--normal, 0.25s ease);
      }

      &:hover::before { transform: scaleY(1); }

      gap: var(--wp--preset--spacing--60, 2rem);

      .service-n { min-inline-size: 44px; flex-shrink: 0; }

      .service-name { flex: 0 0 auto; }

      .service-desc { flex: 1 1 auto; }

      .service-link {
        flex-shrink: 0;
        opacity: 0;
        transition: opacity var(--wp--custom--transition--normal, 0.25s ease);

        a {
          color: var(--wp--preset--color--primary);
          text-decoration: none;
          border-block-end: 1px solid color-mix(in oklch, var(--wp--preset--color--primary) 30%, transparent);
          padding-block-end: 2px;
        }
      }

      &:hover .service-link { opacity: 1; }

      @media (max-width: 768px) {
        flex-wrap: wrap;
        gap: var(--wp--preset--spacing--40, 1rem);

        .service-desc,
        .service-link { display: none; }
      }
    }
  }

  /* ── Hero ─────────────────────────────────────────────────────────────── */

  .hero-section {
    margin-block-start: 0;

    .wp-block-cover__inner-container {
      padding-inline: var(--wp--preset--spacing--70, 3.5rem);
      padding-block-end: var(--wp--preset--spacing--80, 4rem);
      max-inline-size: 100%;
      margin-inline: auto;
      inline-size: 100%;
      box-sizing: border-box;

      @media (max-width: 768px) {
        padding-inline: var(--wp--preset--spacing--50, 1.5rem);
        padding-block-end: var(--wp--preset--spacing--70, 3rem);
      }
    }

    .hero-heading {
      font-size: var(--wp--preset--font-size--4x-large);
      font-family: var(--wp--preset--font-family--heading);
      max-inline-size: 14ch;
      margin-block-end: var(--wp--preset--spacing--60, 2rem);
      letter-spacing: -0.01em;

      em { font-style: italic; }
    }

    .hero-bottom {
      gap: var(--wp--preset--spacing--60, 2rem);

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

    .hero-desc {
      color: color-mix(in oklch, var(--wp--preset--color--base) 55%, transparent);
      max-inline-size: 480px;
    }

    .hero-cta .wp-block-button__link {
      white-space: nowrap;

      &:hover { opacity: 0.88; }
    }

    @media (max-width: 768px) {
      .hero-bottom .wp-block-buttons,
      .hero-cta {
        inline-size: auto;
        align-self: flex-start;
        justify-content: flex-start;
      }

      .hero-cta .wp-block-button__link {
        inline-size: auto;
        display: inline-block;
        text-align: start;
      }
    }
  }

  /* ── Story hero (single-asiakastarina) ─────────────────────────────────── */

  .story-hero {
    .wp-block-cover__inner-container {
      padding-block-start: var(--wp--preset--spacing--90, 5rem);
    }
  }

  /* ── Reference ─────────────────────────────────────────────────────────── */

  .reference-section {

    .ref-right > p:not(.btn-ghost-gold) {
      color: rgba(255,255,255,0.65) !important;
    }

    /* Align columns full height */
    .wp-block-columns {
      align-items: stretch;
    }

    .ref-left {
      display: flex;
      flex-direction: column;

      .wp-block-cover {
        flex: 1 0 auto;
        min-block-size: 520px !important;
      }

      .wp-block-cover__inner-container {
        padding: var(--wp--preset--spacing--60, 2rem);
        align-self: flex-end;
      }
    }

    .ref-right {
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .btn-ghost-gold a {
      display: inline-block;
      color: var(--wp--preset--color--primary);
      text-decoration: none;
      border: 1px solid color-mix(in oklch, var(--wp--preset--color--primary) 40%, transparent);
      padding: var(--wp--preset--spacing--40, 1rem) var(--wp--preset--spacing--70, 3.5rem);
      transition: background var(--wp--custom--transition--normal, 0.25s ease),
                  color var(--wp--custom--transition--normal, 0.25s ease);

      &:hover {
        background: var(--wp--preset--color--primary);
        color: var(--wp--preset--color--contrast);
      }
    }

    @media (max-width: 768px) {
      .wp-block-columns { flex-direction: column; }

      .ref-left { min-block-size: 300px; }
    }
  }

  /* ── Testimonials ───────────────────────────────────────────────────────── */

  .testimonials-section {

    .testi-card {
      position: relative;
      padding-block-start: var(--wp--preset--spacing--60, 2rem);

      &::before {
        content: "";
        position: absolute;
        inset-block-start: 0;
        inset-inline-start: 0;
        inline-size: 24px;
        block-size: 2px;
        background: var(--wp--preset--color--primary);
      }
    }
  }

  /* ── CTA ────────────────────────────────────────────────────────────────── */

  .cta-section {

    .cta-action {
      position: relative;

      @media (min-width: 769px) {
        padding-inline-start: var(--wp--preset--spacing--90, 5rem);

        &::before {
          content: "";
          position: absolute;
          inset-inline-start: 0;
          inset-block: var(--wp--preset--spacing--30, 0.5rem);
          inline-size: 1px;
          background: color-mix(in oklch, var(--wp--preset--color--primary) 25%, transparent);
        }
      }
    }

    .cta-btn .wp-block-button__link {
      &:hover { opacity: 0.88; }
    }

    @media (max-width: 768px) {
      .wp-block-columns { flex-direction: column; }

      .cta-action {
        padding-block-start: var(--wp--preset--spacing--60, 2rem) !important;

        &::before { display: none; }
      }
    }
  }

  /* ========================================================================
     FAQ section — natiivi <details>/<summary>
     ======================================================================== */
  .faq-section .faq-image {
    align-self: flex-start;
  }

  .faq-section .faq-image .wp-block-cover {
    min-block-size: 620px;
  }

  .features-section .features-image .wp-block-cover {
    min-block-size: 100%;
  }

  /* Mobile: stacked columns should not carry desktop side padding */
  @media (max-width: 781px) {
    .features-section .features-content,
    .faq-section .faq-content {
      padding-inline: 0 !important;
    }
  }

  /* Mobile: reduce vertical section padding so gaps between sections shrink */
  @media (max-width: 768px) {
    .intro-section,
    .features-section,
    .process-section,
    .reference-section,
    .services-section,
    .cta-section,
    .faq-section,
    .chatbot-section,
    .gallery-teaser,
    .gallery-section {
      padding-block: var(--wp--preset--spacing--70, 3rem) !important;
    }

    .faq-section .faq-image .wp-block-cover {
      min-block-size: 360px !important;
    }

    /* Process steps stack vertically on mobile — make them compact like features */
    .process-steps .p-step {
      display: grid;
      grid-template-columns: auto 1fr;
      column-gap: var(--wp--preset--spacing--60, 2rem);
      align-items: start;
      padding-block: var(--wp--preset--spacing--50, 1.5rem) !important;
      padding-inline: 0 !important;
      border-right: 0 !important;
      border-block-end: 1px solid var(--wp--preset--color--muted);
    }

    .process-steps .p-step:last-child {
      border-block-end: 0;
    }

    .process-steps .p-step > .step-n {
      grid-row: 1 / span 2;
      align-self: center !important;
      justify-self: start;
      margin-block: 0 !important;
      min-inline-size: 3ch;
    }

    .process-steps .p-step > :not(.step-n) {
      grid-column: 2;
    }
  }

  .faq-section {
    .faq-list {
      border-block-start: 1px solid var(--wp--preset--color--muted);
    }

    .faq-item {
      display: block;
      inline-size: 100%;
      border-block-end: 1px solid var(--wp--preset--color--muted);

      & > summary {
        cursor: pointer;
        list-style: none;
        padding-block: var(--wp--preset--spacing--50, 1.5rem);
        padding-inline-end: var(--wp--preset--spacing--60, 2rem);
        font-size: 1.15rem;
        font-weight: 400;
        line-height: 1.4;
        color: var(--wp--preset--color--contrast);
        position: relative;
        transition: color var(--transition-fast, 150ms ease);

        &::-webkit-details-marker { display: none; }

        &::after {
          content: "+";
          position: absolute;
          inset-inline-end: 0;
          inset-block-start: 50%;
          translate: 0 -50%;
          font-size: 1.5rem;
          font-weight: 200;
          color: var(--wp--preset--color--primary);
          transition: rotate var(--transition-normal, 250ms ease);
        }

        &:hover { color: var(--wp--preset--color--primary); }
      }

      &[open] > summary {
        color: var(--wp--preset--color--primary);

        &::after { rotate: 45deg; }
      }

      & > p {
        padding-block-end: var(--wp--preset--spacing--50, 1.5rem);
        padding-inline-end: var(--wp--preset--spacing--70, 2.5rem);
        font-size: 1rem;
        font-weight: 300;
        line-height: 1.8;
        color: var(--wp--preset--color--muted);
        margin-block-start: 0;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .faq-item > summary::after { transition: none; }
    }
  }

  /* ========================================================================
     Features list — "Mitä työhön kuuluu"
     ======================================================================== */
  .features-list {
    .feature-item {
      inline-size: 100%;
      gap: var(--wp--preset--spacing--60, 2rem);

      .feature-num {
        flex: 0 0 auto;
        min-inline-size: 3ch;
      }
    }

    @container (max-width: 540px) {
      .feature-item {
        flex-direction: column;
        gap: var(--wp--preset--spacing--30, 0.75rem);
      }
    }
  }

  /* ── Gallery section (masonry) ─────────────────────────────────────────── */

  .gallery-section {
    .gallery-label { margin-block-end: var(--wp--preset--spacing--60, 2rem); }

    .wp-block-gallery {
      display: block !important;
      columns: 3;
      column-gap: var(--wp--preset--spacing--40, 1rem);
      margin-inline: auto;
      inline-size: 100%;

      .wp-block-image {
        break-inside: avoid;
        margin-block-end: var(--wp--preset--spacing--40, 1rem);
        display: block;
      }
    }

    /* @container not used: wp-block-group ancestor has no container-type */
    @media (max-width: 768px) {
      .wp-block-gallery { columns: 2; }
    }

    @media (max-width: 480px) {
      .wp-block-gallery { columns: 1; }
    }
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

@layer utilities {
  /* Visually hidden but accessible to screen readers */
  .screen-reader-text {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  /* Text color utilities mapped to token scale */
  .has-muted-text {
    color: var(--wp--preset--color--muted, #64748b);
  }

  .has-success-text {
    color: var(--color-success, #16a34a);
  }

  .has-warning-text {
    color: var(--color-warning, #ca8a04);
  }

  .has-error-text {
    color: var(--color-error, #dc2626);
  }

  /* Raised surface with shadow */
  .has-raised-surface {
    background: var(--color-surface, #fff);
    box-shadow: var(--wp--preset--shadow--md);
    border-radius: var(--wp--preset--border--radius--medium, 0.5rem);
  }

  .hienolista {
    li {
      margin-block-start: 10px;

      &::before {
        content: "✓";
        color: var(--wp--preset--color--primary);
        font-weight: 700;
        margin-inline-end: 0.5em;
      }
    }
  }
}

/* ==========================================================================
   Overrides — bypass theme.json cache for critical sizes
   ========================================================================== */

h3, h3.wp-block-heading {
  font-size: 2.9rem;
}

/* Pakota inline-tyylillä varustetut h3:t paino 600 + kasvatettu koko.
   Sivujen sisältö on tallennettu DB:hen vanhoilla inline-tyyleillä (font-weight:400, font-size:1.2rem),
   jotka eivät päivity pattern-tiedoston muutoksilla. */
h3.wp-block-heading[style*="font-weight:400"],
h3.wp-block-heading[style*="font-weight: 400"] {
  font-weight: 600 !important;
}
h3.wp-block-heading[style*="font-size:1.2rem"],
h3.wp-block-heading[style*="font-size: 1.2rem"] {
  font-size: 1.4rem !important;
}

body, p, .wp-block-paragraph {
  font-size: 1.1rem;
}

/* ==========================================================================
   Styles outside @layer so they're globally accessible
   ========================================================================== */

main {
  &,
  & > * {
    margin-block-start: 0;
  }
}

@keyframes clipPathCircleOpen {
  0% {
    clip-path: circle(0% at top right);
  }
  100% {
    clip-path: circle(250% at top right);
  }
}

@keyframes clipPathCircleClose {
  0% {
    clip-path: circle(250% at top right);
  }
  100% {
    clip-path: circle(0% at top right);
  }
}

@layer overrides {
  *:focus {
    outline: none !important;
  }

  .single-asiakastarinat .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: var(--wp--style--global--wide-size);
  }

  .single-asiakastarinat .site-header {
    background: var(--wp--preset--color--contrast);
    box-shadow: var(--wp--preset--shadow--md);
  }
}

/* ==========================================================================
   Decorative icons
   ========================================================================== */

.hero-section::after {
  content: '';
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 5vw;
  transform: translateY(-50%);
  inline-size: clamp(260px, 32vw, 500px);
  aspect-ratio: 1;
  background: url('assets/images/sisustusmiehet-ornamentti-valkoinen.png') center / contain no-repeat;
  opacity: 0.15;
  pointer-events: none;
  z-index: 2;
}

.services-section::after {
  content: '';
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 4vw;
  transform: translateY(-50%);
  inline-size: clamp(180px, 22vw, 340px);
  aspect-ratio: 1;
  background: url('assets/images/sisustusmiehet-ornamentti-valkoinen.png') center / contain no-repeat;
  opacity: 0.15;
  pointer-events: none;
  z-index: 2;
}

.site-footer {
  position: relative;
  overflow: hidden;
}

@media (max-width: 768px) {
  .site-footer .wp-block-group.alignwide {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--wp--preset--spacing--30, 0.75rem);
  }
}

.site-footer::after {
  content: '';
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 5vw;
  transform: translateY(-50%);
  inline-size: clamp(70px, 9vw, 120px);
  aspect-ratio: 1;
  background: url('assets/images/sisustusmiehet-ornamentti-valkoinen.png') center / contain no-repeat;
  opacity: 0.3;
  pointer-events: none;
}

.post-password-form {
padding: 120px 5% 80px 5%;
}
