/* ==========================================================================
   CNC PAKALPOJUMI — globālie stili
   --------------------------------------------------------------------------
   Šis fails satur dizaina sistēmas pamatu:
     1. CSS mainīgie (krāsas, tipogrāfija, atstarpes)
     2. Reset un bāzes stili
     3. Tipogrāfija un hierarhija
     4. Layout palīgklases (container, section, grid)
     5. Utilitātes (režģa motīvs, visually-hidden, skip-link u.c.)

   Komponenti (pogas, kartītes, formas) atrodas components.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DIZAINA MAINĪGIE — krāsu un fontu sistēma
   -------------------------------------------------------------------------- */
:root {
  /* — Pamata krāsas — silts, ne tīri balts pamats — */
  --bg: #FBF9F6;              /* pamata fons (silts off-white) */
  --bg-soft: #F5F2ED;         /* sekundārais fons (sekciju dalīšanai) */
  --bg-muted: #EEEBE5;        /* kartītes, bloki, formas fons */

  /* — Teksts — */
  --text: #1A1A1A;            /* pamata teksts (ne tīri melns) */
  --text-muted: #5C626A;      /* sekundārais teksts */
  --text-faint: #8A9099;      /* maznozīmīgs teksts, vietturi */

  /* — Akcents — tumšāks, rūpniecisks oranžs, lietots atturīgi — */
  --accent: #B45309;          /* atbilst WCAG AA (≥4.5:1 uz fona) */
  --accent-hover: #92400E;
  --accent-soft: #FAEADB;     /* gaišs akcenta fons (izcēlumiem) */
  --accent-contrast: #FFFFFF; /* teksts uz akcenta fona */

  /* — Robežas un līnijas — silti pelēkas — */
  --border: #E4E0D8;
  --border-strong: #C9C2B7;
  --grid-line: #EFEAE2;       /* režģa motīva līnijas fonā */

  /* — Stāvokļi (formu validācija, ziņojumi) — */
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --success: #067647;
  --success-soft: #ECFDF3;

  /* — Caurspīdīgs fons sticky header — */
  --bg-translucent: rgba(251, 249, 246, 0.9);

  /* — Tipogrāfija — viena fontu ģimene visam — */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fs-h1: clamp(2rem, 1.35rem + 2vw, 2.75rem);     /* 32–44px */
  --fs-h2: clamp(1.5rem, 1.2rem + 1vw, 2rem);       /* 24–32px */
  --fs-h3: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);  /* 20–24px */
  --fs-body: 1rem;            /* 16px */
  --fs-small: 0.875rem;       /* 14px */
  --fs-tiny: 0.8125rem;       /* 13px */
  --lh-tight: 1.15;
  --lh-body: 1.6;

  /* — Atstarpes (8px režģis) — */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* — Layout — */
  --container: 76rem;         /* 1216px */
  --container-narrow: 56rem;  /* 896px */
  --header-height: 4.5rem;    /* 72px — sticky header */

  /* — Stūri — atturīgi, industriāls raksturs — */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* — Ēnas — smalkas, tikai funkcionālai nošķiršanai — */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);

  /* — Pārejas — */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;

  /* — Fokuss (pieejamība, WCAG AA) — */
  --focus-ring: 3px solid rgba(180, 83, 9, 0.45);
  --focus-offset: 2px;
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* kompensē sticky header, kad navigē ar anchor saitēm */
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   3. TIPOGrāfIJA
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: 1.0625rem; }

p {
  max-width: 65ch;
}

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

/* akcenta līnija virs virsraksta — atturīgs vizuālais akcents */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-tiny);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 1.5rem;
  height: 2px;
  background-color: var(--accent);
}

/* --------------------------------------------------------------------------
   4. LAYOUT
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--space-8);
}

.section--muted {
  background-color: var(--bg-soft);
  border-block: 1px solid var(--border);
}

.section--muted-strong {
  background-color: var(--bg-muted);
}

.section-head {
  max-width: 44rem;
  margin-bottom: var(--space-7);
}

.section-head h2 {
  margin-top: var(--space-3);
}

.section-head .lead {
  margin-top: var(--space-4);
  color: var(--text-muted);
  font-size: 1.0625rem;
}

/* --------------------------------------------------------------------------
   5. REŽĢA MOTĪVS (CNC/precizitātes tēma)
   -------------------------------------------------------------------------- */
.grid-bg {
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* smalka režģa maska — lai motīvs būtu redzams tikai lokāli */
.grid-mask {
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 75%);
}

/* Scroll reveal — elementi ar data-reveal parādās, iebraucot skatā.
   Darbojas tikai, ja JavaScript ir ieslēgts (klase .js uz <html>). */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   6. PIEEJAMĪBA UN UTILITĀTES
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* izlaižamā saite — pirmā tēmas fokusa secībā */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100%;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--text);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 0.5rem;
  color: #FFFFFF;
}

/* redzami fokusa stāvokļi visiem interaktīvajiem elementiem */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

::selection {
  background-color: var(--accent);
  color: var(--accent-contrast);
}

/* samazinātas kustības preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   7. RESPONSĪVĀS ATSTARPES
   -------------------------------------------------------------------------- */
@media (max-width: 40em) {
  .section {
    padding-block: var(--space-7);
  }

  .container {
    padding-inline: var(--space-4);
  }
}
