/* ============================================================
   CricoSoft — Base
   Load order: 1 tokens > [2 base] > 3 components > 4 mockups > 5 sections

   Reset, document defaults, typography and the layout primitives
   (shell, section, grid, eyebrow, heading, prose). Nothing here knows
   about a specific component.
   ============================================================ */

/* ---------- Reset ---------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Header height plus breathing room, so an anchored section does not
     land underneath the sticky header. */
  scroll-padding-top: 6rem;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--cricosoft-bg);
  color: var(--cricosoft-fg);
  font-family: var(--cricosoft-font-body);
  font-size: var(--cricosoft-text-base);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Nothing in this project is allowed to scroll sideways. If something
     does, this clips it rather than shipping a broken phone layout —
     but the real fix is always to find the offending element. */
  overflow-x: clip;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img { height: auto; }

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

button { background: none; border: none; }

p,
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

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

/* ---------- Focus ----------
   One visible ring everywhere. It is deliberately offset so it reads on
   both a flat background and a filled button. */

:focus-visible {
  outline: 2px solid var(--cricosoft-focus);
  outline-offset: 3px;
  border-radius: var(--cricosoft-radius-xs);
}

:focus:not(:focus-visible) { outline: none; }

/* ---------- Selection ---------- */

::selection {
  background: var(--cricosoft-brand-500);
  color: #FFFFFF;
}

/* ---------- Scrollbar (progressive enhancement) ---------- */

@supports (scrollbar-width: thin) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--cricosoft-surface-4) transparent;
  }
}

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--cricosoft-font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 { font-size: var(--cricosoft-text-5xl); letter-spacing: -0.032em; }
h2 { font-size: var(--cricosoft-text-3xl); letter-spacing: -0.026em; }
h3 { font-size: var(--cricosoft-text-xl);  }
h4 { font-size: var(--cricosoft-text-lg);  }
h5 { font-size: var(--cricosoft-text-md);  }
h6 { font-size: var(--cricosoft-text-base); }

p { text-wrap: pretty; }

a {
  color: var(--cricosoft-brand-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--cricosoft-dur-fast) var(--cricosoft-ease);
}

a:hover { color: var(--cricosoft-brand-500); }

strong, b { font-weight: 600; }

hr {
  border: none;
  border-top: 1px solid var(--cricosoft-line);
  margin: var(--cricosoft-space-8) 0;
}

code, kbd, samp, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

/* ---------- Layout primitives ---------- */

/* The one horizontal container. Everything sits inside a shell — that is
   what guarantees a consistent gutter at every width. */
.cricosoft-shell {
  width: 100%;
  max-width: calc(var(--cricosoft-width) + var(--cricosoft-gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--cricosoft-gutter);
}

.cricosoft-shell--wide {
  max-width: calc(var(--cricosoft-width-wide) + var(--cricosoft-gutter) * 2);
}

.cricosoft-shell--narrow {
  max-width: calc(var(--cricosoft-width-narrow) + var(--cricosoft-gutter) * 2);
}

.cricosoft-section {
  position: relative;
  padding-block: var(--cricosoft-section-y);
}

.cricosoft-section--tight { padding-block: var(--cricosoft-section-y-tight); }
.cricosoft-section--alt   { background: var(--cricosoft-bg-subtle); }

/* A hairline between two sections that share a background, so the rhythm
   does not dissolve into one long scroll. */
.cricosoft-section--ruled { border-top: 1px solid var(--cricosoft-line); }

/* ---------- Section heading block ---------- */

.cricosoft-head {
  max-width: 62ch;
  margin-bottom: clamp(2rem, 1.4rem + 2.6vw, 3.75rem);
}

.cricosoft-head--center {
  margin-inline: auto;
  text-align: center;
}

.cricosoft-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--cricosoft-space-2);
  margin-bottom: var(--cricosoft-space-4);
  font-size: var(--cricosoft-text-xs);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cricosoft-brand-ink);
}

/* The small square that precedes every eyebrow. Decorative — it is a
   pseudo-element so it never reaches a screen reader. */
.cricosoft-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--cricosoft-brand-500);
  rotate: 45deg;
}

.cricosoft-head__title { margin-bottom: var(--cricosoft-space-4); }

.cricosoft-head__lede {
  font-size: var(--cricosoft-text-md);
  color: var(--cricosoft-fg-muted);
  max-width: var(--cricosoft-width-prose);
}

.cricosoft-head--center .cricosoft-head__lede { margin-inline: auto; }

/* ---------- Grid primitive ----------
   Mobile-first: one column, then min-width queries add columns. There is
   no max-width query anywhere in this project. */

.cricosoft-grid {
  display: grid;
  gap: clamp(1rem, 0.7rem + 1.4vw, 1.75rem);
}

@media (min-width: 640px) {
  .cricosoft-grid--2 { grid-template-columns: repeat(2, 1fr); }
  .cricosoft-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .cricosoft-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .cricosoft-grid--3 { grid-template-columns: repeat(3, 1fr); }
  .cricosoft-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Prose ---------- */

.cricosoft-prose {
  max-width: var(--cricosoft-width-prose);
  font-size: var(--cricosoft-text-md);
  color: var(--cricosoft-fg-muted);
}

.cricosoft-prose > * + * { margin-top: var(--cricosoft-space-5); }

.cricosoft-prose h2,
.cricosoft-prose h3 {
  color: var(--cricosoft-fg);
  margin-top: var(--cricosoft-space-10);
}

.cricosoft-prose h2 + *,
.cricosoft-prose h3 + * { margin-top: var(--cricosoft-space-3); }

.cricosoft-prose ul {
  padding-left: 1.15em;
  list-style: none;
}

.cricosoft-prose ul li {
  position: relative;
  padding-left: 1em;
}

.cricosoft-prose ul li + li { margin-top: var(--cricosoft-space-2); }

.cricosoft-prose ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: var(--cricosoft-brand-500);
  rotate: 45deg;
}

.cricosoft-prose blockquote {
  margin: var(--cricosoft-space-8) 0;
  padding-left: var(--cricosoft-space-6);
  border-left: 2px solid var(--cricosoft-brand-500);
  font-family: var(--cricosoft-font-quote);
  font-style: italic;
  font-size: var(--cricosoft-text-xl);
  line-height: 1.4;
  color: var(--cricosoft-fg);
}

/* ---------- Utilities ---------- */

.cricosoft-visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cricosoft-skip-link {
  position: absolute;
  top: var(--cricosoft-space-3);
  left: var(--cricosoft-space-3);
  z-index: var(--cricosoft-z-skip-link);
  padding: var(--cricosoft-space-3) var(--cricosoft-space-5);
  border-radius: var(--cricosoft-radius-sm);
  background: var(--cricosoft-brand-500);
  color: #FFFFFF;
  font-weight: 600;
  text-decoration: none;
  translate: 0 -150%;
  transition: translate var(--cricosoft-dur) var(--cricosoft-ease-out);
}

.cricosoft-skip-link:focus { translate: 0 0; color: #FFFFFF; }

/* The grain overlay used on the hero and the closing band. Decorative,
   pointer-events none, and cheap — an inline SVG turbulence, not an image. */
.cricosoft-grain { position: relative; isolation: isolate; }

.cricosoft-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: light-dark(.30, .16);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* Hides content until the reveal observer runs. Guarded by .no-js so the
   page is fully readable with JavaScript switched off. */
html:not(.no-js) .cricosoft-reveal {
  opacity: 0;
  translate: 0 18px;
  transition:
    opacity var(--cricosoft-dur-slow) var(--cricosoft-ease-out),
    translate var(--cricosoft-dur-slow) var(--cricosoft-ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

html:not(.no-js) .cricosoft-reveal.is-visible {
  opacity: 1;
  translate: 0 0;
}

@media (prefers-reduced-motion: reduce) {
  html:not(.no-js) .cricosoft-reveal { opacity: 1; translate: none; }
}
