/* Shared styles used on every page. Loaded after each page's inline <style>. */

/* ---- Typography ----
   Switch the heading font site-wide by changing these variables.
   The font itself is loaded in each page's <head> (Google Fonts link).
   The root font size is the browser default (16px = 1rem); no global scaling. */
:root{
  --font-heading: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --heading-weight: 600;        /* large headings */
  --heading-weight-small: 700;  /* headings under ~28px, for legibility */
  --heading-scale: 1.39;        /* applied to every heading size; Cormorant has a small x-height */
  --section-title-size: calc(clamp(1.5rem, 2.67vw, 2rem) * var(--heading-scale));  /* section headings (Skjutpartier, Räcken) */

  --color-body: #3d4757;        /* body text: soft gray-blue, ~9.5:1 on white */
  --body-size: 17px;
  --body-size-mobile: 16px;
}

body{
  font-size: var(--body-size);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-body);
}

@media (max-width: 768px){
  body{ font-size: var(--body-size-mobile); }
}

h1, h2, h3{
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  line-height: 1.12;
  letter-spacing: normal;
  font-variant-numeric: lining-nums;
}

/* Small headings (card / step / contact titles) */
h3{ font-weight: var(--heading-weight-small); }

/* ---- Guard against sideways scrolling on mobile ----
   Nothing should be wider than the viewport; this catches any stray overflow
   (e.g. slide-in animations) in browsers that ignore `overflow-x: clip`. */
body{ overflow-x: hidden; }

/* ---- Contact CTA band ("Vill du veta mer?") ----
   Markup:
   <section class="cta-band" aria-labelledby="cta-band-title">
     <div class="cta-band__inner">
       <h2 id="cta-band-title">Vill du veta mer?</h2>
       <p>Kontakta oss för rådgivning och en kostnadsfri offert.</p>
       <a class="btn" href="index.html#contact">Kontakta oss</a>
     </div>
   </section>
*/
.cta-band{
  width: 100%;
  margin: 0;
  padding: clamp(44px, 6vw, 64px) 24px;
  background: var(--color-header, #0b2340);
  color: #fff;
  text-align: center;
  border-radius: 0;
  box-shadow: none;
}

.cta-band__inner{
  max-width: 680px;
  margin: 0 auto;
}

.cta-band h2{
  margin: 0 0 12px;
  font-size: calc(1.6rem * var(--heading-scale));
  color: #fff;
}

.cta-band p{
  margin: 0 0 24px;
  color: var(--color-soft, #e8edf3);
}

/* Same, tight spacing between the last section and the band on every page */
section:has(+ .cta-band){
  padding-bottom: clamp(32px, 4vw, 48px);
}

@media (max-width: 768px){
  .cta-band .btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }
}

/* ---- Mobile menu: scroll inside if it is taller than the screen ---- */
@media (max-width: 860px){
  nav.primary-nav.open{
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}

/* ---- Accessibility (pre-launch audit) ----
   1. Text and buttons use a darker blue so they reach 4.5:1 (white text on it 5.5:1,
      the blue on white 5.5:1 and on the gray sections 4.9:1). The original accent
      (#2f7de1) stays for borders, accent lines and focus rings, where it passes 3:1
      on both white and navy. */
:root{
  --color-accent-strong: #2467c4;
  --color-accent-strong-hover: #1c5099;
}

.btn,
.skip-link,
.process-number{ background: var(--color-accent-strong); }
.btn:hover,
.btn:focus{ background: var(--color-accent-strong-hover); }

.section-heading .eyebrow,
.breadcrumb a,
.contact-card p a,
.js .rm-toggle{ color: var(--color-accent-strong); }

/* 2. Inactive carousel dots: at least 3:1 against white and the gray sections */
.carousel-dots button:not([aria-current="true"])::before,
.carousel-dots .dot:not(.active){ background: rgba(11,35,64,0.5); }

/* 3. Mobile menu: while closed it is also hidden from keyboard and screen readers
      (visibility switches after the collapse animation, so the slide still shows) */
@media (max-width: 860px){
  nav.primary-nav{
    visibility: hidden;
    transition: max-height var(--transition, 0.25s ease), top 0.3s ease, visibility 0s linear 0.3s;
  }
  nav.primary-nav.open{
    visibility: visible;
    transition: max-height var(--transition, 0.25s ease), top 0.3s ease, visibility 0s;
  }
}

/* 4. No smooth scrolling for visitors who ask for reduced motion */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
}

/* ---- Desktop menu on narrow screens: seven links next to the logo ----
   Between the mobile breakpoint and ~1080px, tighten spacing and size a little
   so the menu stays on one line without touching the logo. */
@media (min-width: 861px) and (max-width: 1080px){
  nav.primary-nav ul{ gap: 14px; }
  nav.primary-nav a{ font-size: 0.95rem; }
}
