/* ==========================================================
   Scan-Tronic PRO — Base
   (reset-lite + layout primitives)
========================================================== */

/* Reset-lite (replaces Tailwind preflight) */
*,*::before,*::after{ box-sizing: border-box; }
html,body{ height:100%; }

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

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

body{
  margin:0;
  background: var(--st-bg);
  color: var(--st-text);
  font-size: var(--st-fs-body);
  line-height: var(--st-lh-body);
  font-family: var(--st-ff-sans);
}

/* Global background character (neutral by default / light stays clean) */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -3;
  background: var(--st-bg);
}

body::after{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--st-bg-gradient);
  pointer-events: none;
}

/* ==============================
   DARK THEME BACKGROUND SYSTEM
   - bottom.png = whole site continuation
   - main.png   = hero only
============================== */

html[data-theme="dark"] body::before{
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.18), rgba(0,0,0,0.42)),
    url("../img/bg/bottom.png") center top / cover repeat-y,
    rgb(var(--st-rgb-bg));
}

html[data-theme="dark"] body::after{
  background:
    radial-gradient(circle at 72% 18%, rgb(var(--st-rgb-accent) / 0.10), transparent 30%),
    radial-gradient(circle at 54% 72%, rgb(var(--st-rgb-accent) / 0.06), transparent 38%);
}

html[data-theme="dark"] .st-hero{
  position: relative;
  overflow: clip;
  isolation: isolate;
}

html[data-theme="dark"] .st-hero::before{
  content:"";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(
      to bottom,
      rgb(var(--st-rgb-bg) / 0.04) 0%,
      rgb(var(--st-rgb-bg) / 0.08) 38%,
      rgb(var(--st-rgb-bg) / 0.20) 58%,
      rgb(var(--st-rgb-bg) / 0.42) 74%,
      rgb(var(--st-rgb-bg) / 0.72) 88%,
      rgb(var(--st-rgb-bg) / 0.96) 96%,
      rgb(var(--st-rgb-bg) / 1.00) 100%
    ),
    url("../img/bg/main.png") center top / cover no-repeat;
  opacity: 1;
}

html[data-theme="dark"] .st-hero > *{
  position: relative;
  z-index: 1;
}

/* Links */
a{
  color: inherit;
  text-decoration: none;
}

a:focus-visible{
  outline: 2px solid rgb(var(--st-rgb-accent) / 0.55);
  outline-offset: 3px;
  border-radius: var(--st-radius-s);
}

/* Typography (global hierarchy) */
h1{ font-size: var(--st-fs-h1); line-height: var(--st-lh-tight); }
h2{ font-size: var(--st-fs-h2); line-height: 1.18; }
h3{ font-size: var(--st-fs-h3); line-height: 1.2; }
h4{ font-size: var(--st-fs-h4); }
h5{ font-size: var(--st-fs-h5); }
h6{ font-size: var(--st-fs-h6); }

h1,h2,h3,h4,h5,h6{
  margin: 0 0 var(--st-space-2);
  letter-spacing: -.02em;
  color: var(--st-text);
}

p{
  margin: 0 0 var(--st-space-2);
  color: var(--st-muted);
}

/* Small / note text */
.st-small{
  font-size: var(--st-fs-2xs);
  line-height: 1.45;
  color: rgb(var(--st-rgb-text) / 0.62);
}

/* Preserve line breaks from text blobs */
.st-pre-line{ white-space: pre-line; }


/* ==============================
   Layout primitives
============================== */
.st-container{
  width: min(var(--st-container-max), calc(100% - var(--st-space-4)));
  margin-inline: auto;
}

/* Centralised section spacing */
.st-section{
  padding: var(--st-section-y) 0;
  border-top: var(--st-border-w) solid var(--st-border);
}

.st-section--noborder{ border-top: none; }

/* Standardised section header pattern */
.st-section__head{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-end;
  justify-content: space-between;
  gap: var(--st-space-2);
  margin-bottom: 0;
}

/*
  Global section rhythm:
  .st-section__head
  ↓
  next direct content block
*/
.st-section > .st-section__head + *{
  margin-top: var(--st-section-head-gap);
}

/* Compact sections can override the gap token */
.st-section--compact{ --st-section-head-gap: var(--st-space-2); }

.st-section__copy{ max-width: 72ch; }

/* Stack (vertical spacing) */
.st-stack{
  display:flex;
  flex-direction: column;
  gap: var(--st-space-2);
}
.st-stack--m{ gap: var(--st-space-3); }
.st-stack--l{ gap: var(--st-space-4); }


/* Grid system (cards + page layouts) */
.st-grid{
  display:grid;
  gap: var(--st-grid-gap);
}

.st-grid--2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.st-grid--3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.st-grid--4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.st-grid--auto{ grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }

/* Responsive grid rules */
@media (max-width: 1023px){
  .st-grid--4{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px){
  .st-grid--2,
  .st-grid--3,
  .st-grid--4{ grid-template-columns: 1fr; }
}

/* ==============================
   Hero system (one system, variants)
============================== */
.st-hero{
  display:grid;
  gap: var(--st-grid-gap);
  grid-template-columns: minmax(0,1.2fr) minmax(0,1fr);
  align-items: stretch;

  /* Fully token-driven offset */
  padding-top: calc(var(--st-hero-y) + var(--st-header-h));
}

.st-hero--single{ grid-template-columns: 1fr; }
.st-hero--center{ text-align:center; justify-items:center; }

.st-hero > .st-hero__content{
  padding-left: clamp(12px, 1.6vw, 28px);
}

.st-hero__actions{
  margin-top: var(--st-space-3);
  display:flex;
  flex-wrap:wrap;
  gap: var(--st-space-2);
}

@media (max-width: 980px){
  .st-hero{
    grid-template-columns: 1fr;
    padding-top: calc(var(--st-hero-y-sm) + var(--st-header-h));
  }

  .st-hero > .st-hero__content{
    padding-left: 0;
  }
}

/* ==========================================================
   SUBPAGE HERO STANDARD
   (all subpages same, front page untouched)
========================================================== */

.st-hero--subpage{
  display:grid;
  grid-template-columns: minmax(0, 50%) minmax(0, 50%);
  align-items:start;
  min-height: 520px;
  padding-top: calc(var(--st-hero-y) + var(--st-header-h));
  padding-bottom: clamp(56px, 8vw, 92px);
  gap: clamp(24px, 4vw, 56px);
}

.st-hero--subpage .st-hero__content{
  width: 100%;
  max-width: none;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  padding-left: clamp(12px, 1.6vw, 28px);
}

.st-hero--subpage .st-hero__media{
  min-height: 100%;
  min-width: 320px;
}

/* right side stays reserved for future image */
.st-hero--subpage .st-hero__media:empty::before{
  content:"";
  display:block;
  width:100%;
  min-height: 320px;
}

.st-hero--subpage .st-kicker{
  margin: 0 0 20px;
}

.st-hero--subpage h1{
  width: 100%;
  max-width: none;
  margin: 0 0 24px;
}

.st-hero--subpage .st-subtitle{
  width: 100%;
  max-width: none;
  margin: 0;
}

.st-hero--subpage .st-hero__actions{
  margin-top: 32px;
}

/* dark hero image only for subpages */
html[data-theme="dark"] .st-hero--subpage{
  position: relative;
  overflow: clip;
  isolation: isolate;
}

html[data-theme="dark"] .st-hero--subpage::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  background:
    linear-gradient(
      to right,
      rgb(var(--st-rgb-bg) / 0.70) 0%,
      rgb(var(--st-rgb-bg) / 0.44) 28%,
      rgb(var(--st-rgb-bg) / 0.18) 52%,
      rgb(var(--st-rgb-bg) / 0.10) 68%,
      rgb(var(--st-rgb-bg) / 0.18) 84%,
      rgb(var(--st-rgb-bg) / 0.44) 100%
    ),
    linear-gradient(
      to bottom,
      rgb(var(--st-rgb-bg) / 0.03) 0%,
      rgb(var(--st-rgb-bg) / 0.10) 58%,
      rgb(var(--st-rgb-bg) / 0.40) 86%,
      rgb(var(--st-rgb-bg) / 1.00) 100%
    ),
    url("../img/bg/main.png") center top / cover no-repeat;
}

.st-hero--subpage > *{
  position:relative;
  z-index:1;
}

html[data-theme="light"] .st-hero--subpage .st-hero__image{
  filter: grayscale(1) contrast(0.90) brightness(1.30);
}

@media (max-width: 1100px){
  .st-hero--subpage{
    grid-template-columns: 1fr;
    min-height: 460px;
  }

  .st-hero--subpage .st-hero__content{
    padding-left: 0;
  }

  .st-hero--subpage .st-hero__media{
    display:none;
  }
}

/* ==============================
   Text helpers (token-driven)
============================== */
.st-kicker{
  font-size: var(--st-fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgb(var(--st-rgb-accent-2) / 1);
}

.st-lead{
  font-size: 16px;
  max-width: 68ch;
}

.st-lead--hero{
  font-size: var(--st-fs-sm);
}
@media (min-width: 768px){
  .st-lead--hero{ font-size: 16px; }
}

.st-subtitle{
  font-size: var(--st-fs-sm);
  max-width: 72ch;
  color: var(--st-muted);
}

.st-title{
  margin: 0 0 var(--st-space-2);
  font-size: var(--st-fs-section-title);
  font-weight: 650;
  letter-spacing: -.02em;
  color: var(--st-text);
}

.st-text-accent{ color: rgb(var(--st-rgb-accent-2) / 1); }

/* State helpers (used by JS) */
.is-hidden{ display:none !important; }
.hidden{ display:none !important; }

/* Documentation grid */
.st-grid--docs{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1023px){
  .st-grid--docs{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px){
  .st-grid--docs{ grid-template-columns: 1fr; }
}