/* ==========================================================================
   Pytronic Labs — Reset, elements, layout primitives, a11y, motion
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

body.is-locked { overflow: hidden; }

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
svg { flex: none; }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

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

a { color: inherit; text-decoration: none; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

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

/* ---- Headings ------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
}
h1 { font-size: var(--fs-4xl); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); font-weight: 700; }
h2 { font-size: var(--fs-3xl); line-height: 1.08; letter-spacing: var(--tracking-tight); font-weight: 650; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { text-wrap: pretty; }

/* ==========================================================================
   Focus — visible, on-brand, never removed
   ========================================================================== */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% -120%;
  z-index: var(--z-toast);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: translate var(--dur-base) var(--ease-out);
}
.skip-link:focus-visible { translate: -50% 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--tight { max-width: var(--container-tight); }

.section { padding-block: var(--section-y); position: relative; }
.section--alt { background: var(--bg-alt); }
.section--flush-top { padding-top: 0; }
.section--tight-bottom { padding-bottom: var(--sp-7); }

.stack > * + * { margin-top: var(--flow, 1rem); }

/* Grid and flex children default to min-width:auto, which lets one wide child
   (a code block, a long URL) stretch the whole track past the viewport.
   Resetting it here is what keeps every layout from overflowing on mobile. */
.grid > *,
.hero-layout > *,
.split > *,
.bento > *,
.stats > *,
.process > *,
.work-grid > *,
.price-grid > *,
.contact-layout > *,
.footer-grid > * { min-width: 0; }

.grid { display: grid; gap: var(--gap, var(--sp-5)); }
@media (min-width: 700px)  { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 700px)  { .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px)  { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* ==========================================================================
   Decorative background layers
   ========================================================================== */

/* Fine engineering grid — sits behind content, fades toward the edges */
.bg-grid {
  position: absolute;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  background-image:
    linear-gradient(to right,  var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 30%, transparent 78%);
}

/* Soft aurora blobs */
.bg-glow {
  position: absolute;
  z-index: var(--z-bg);
  pointer-events: none;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}

/* Film grain, kills gradient banding */
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Scroll-reveal — progressive enhancement.
   JS adds .is-in; without JS, .reveal stays visible (see .no-js rule).
   ========================================================================== */
.js .reveal {
  opacity: 0;
  translate: 0 22px;
  transition:
    opacity var(--dur-slow) var(--ease-out),
    translate var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal.is-in { opacity: 1; translate: 0 0; }

/* ==========================================================================
   Reduced motion — honour it everywhere
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; translate: none; }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .site-header, .site-footer, .bg-grid, .bg-glow, .bg-noise, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}
