/* =========================================================
   SERVOMIX — BASE
   File: css/core/base.css
   Needs: css/core/tokens.css loaded first.

   Reset, page background (mesh), type roles, layout
   helpers, focus and motion rules. No component styles.
========================================================= */

/* ---------------------------------------------------------
   RESET
--------------------------------------------------------- */

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

*{
    margin:0;
}

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

img,
video{
    height:auto;
}

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

button{
    cursor:pointer;
}

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

ul[role="list"],
ol[role="list"]{
    list-style:none;
    padding:0;
}


/* ---------------------------------------------------------
   PAGE
   The page colour lives on <html>; <body> stays transparent
   so the fixed mesh layer behind it stays visible.
--------------------------------------------------------- */

html{
    background:var(--page);
    color:var(--ink);
    font-family:var(--font-sans);
    font-size:100%;
    line-height:var(--lh-body);
    font-stretch:var(--wd-text);
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
    scroll-padding-top:calc(var(--nav-h) + var(--s-5));
}

body{
    position:relative;
    min-height:100dvh;
    background:transparent;
    color:var(--ink);
    font-size:var(--t-body);
}

html[lang="hi"]{
    font-family:var(--font-hi);
}

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


/* ---------- Mesh: four soft blobs that drift slowly ---------- */

body::before{
    content:"";
    position:fixed;
    inset:-20vmax;
    z-index:var(--z-mesh);
    pointer-events:none;
    background:
        radial-gradient(45vmax 38vmax at 25% 10%, var(--mesh-1) 0%, transparent 65%),
        radial-gradient(40vmax 35vmax at 80% 20%, var(--mesh-2) 0%, transparent 60%),
        radial-gradient(50vmax 42vmax at 65% 85%, var(--mesh-3) 0%, transparent 65%),
        radial-gradient(35vmax 30vmax at 12% 80%, var(--mesh-2) 0%, transparent 60%),
        radial-gradient(35vmax 25vmax at 50% 45%, rgba(59, 130, 246, 0.16) 0%, transparent 60%);
    opacity:.9;
    animation:smx-mesh-drift var(--dur-mesh) var(--ease) infinite alternate;
}

@keyframes smx-mesh-drift{
    from{ transform:translate3d(0,0,0) scale(1); }
    to{ transform:translate3d(-3vmax,2vmax,0) scale(1.06); }
}


/* ---------------------------------------------------------
   TYPE ROLES
   Sentence case everywhere. All-caps only in the logo and
   badges.
--------------------------------------------------------- */

h1,
h2,
h3,
h4{
    color:var(--ink);
    text-wrap:balance;
}

.t-display{
    font-size:var(--t-display);
    line-height:var(--lh-display);
    font-weight:var(--w-display);
    font-stretch:var(--wd-display);
    letter-spacing:-.015em;
}

h1,
.t-h1{
    font-size:var(--t-h1);
    line-height:var(--lh-heading);
    font-weight:var(--w-h1);
    font-stretch:var(--wd-h1);
    letter-spacing:-.01em;
}

h2,
.t-h2{
    font-size:var(--t-h2);
    line-height:var(--lh-heading);
    font-weight:var(--w-h2);
    font-stretch:var(--wd-h2);
    letter-spacing:-.005em;
}

h3,
.t-h3{
    font-size:var(--t-h3);
    line-height:var(--lh-h3);
    font-weight:var(--w-h3);
    font-stretch:var(--wd-text);
}

h4{
    font-size:var(--t-body);
    line-height:var(--lh-small);
    font-weight:var(--w-strong);
}

p{
    max-width:var(--measure);
    text-wrap:pretty;
}

.t-lead{
    font-size:var(--t-lead);
    line-height:1.55;
    color:var(--ink-2);
}

.t-small{
    font-size:var(--t-small);
    line-height:var(--lh-small);
}

.t-muted{
    color:var(--ink-2);
}

.t-num{
    font-variant-numeric:tabular-nums;
}

strong,
b{
    font-weight:var(--w-strong);
}

a{
    color:var(--accent);
    text-decoration-thickness:1px;
    text-underline-offset:.2em;
}

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


/* ---------------------------------------------------------
   LAYOUT HELPERS
--------------------------------------------------------- */

.container{
    width:min(var(--container), 100% - var(--gutter) * 2);
    margin-inline:auto;
}

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

.stack{
    display:flex;
    flex-direction:column;
    gap:var(--stack-gap, var(--s-4));
}

.cluster{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:var(--cluster-gap, var(--s-3));
}

.grid-auto{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(min(var(--grid-min, 260px), 100%), 1fr));
    gap:var(--grid-gap, var(--s-5));
}


/* ---------------------------------------------------------
   ICONS (sprite: assets/icons/sprite.svg, ids "ph-<name>")
   <svg class="icon" aria-hidden="true"><use href=".../sprite.svg#ph-check"></use></svg>
--------------------------------------------------------- */

.icon{
    display:inline-block;
    flex:0 0 auto;
    flex-shrink:0;
    width:var(--icon, 20px);
    height:var(--icon, 20px);
    vertical-align:-.2em;
    fill:currentColor;
}

.icon--sm{
    width:var(--icon-sm, 16px);
    height:var(--icon-sm, 16px);
}

.icon--lg{
    width:var(--icon-lg, 24px);
    height:var(--icon-lg, 24px);
}


/* ---------------------------------------------------------
   ACCESSIBILITY
--------------------------------------------------------- */

:focus-visible{
    outline:2px solid var(--accent);
    outline-offset:2px;
    border-radius:4px;
}

.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;
}

.skip-link{
    position:absolute;
    top:var(--s-3);
    left:var(--s-3);
    z-index:var(--z-toast);
    padding:var(--s-3) var(--s-4);
    border-radius:var(--r-control);
    background:var(--surface);
    color:var(--accent);
    font-weight:var(--w-strong);
    box-shadow:var(--shadow-float);
    transform:translateY(-200%);
}

.skip-link:focus{
    transform:none;
}


/* ---------------------------------------------------------
   MOTION
   Respect the OS setting and the site pause switch
   (html[data-motion="off"], set by js/core/ui.js).
--------------------------------------------------------- */

@media (prefers-reduced-motion:reduce){

    *,
    *::before,
    *::after{
        animation-duration:.01ms !important;
        animation-iteration-count:1 !important;
        /* "none", not a tiny duration: a tiny duration still
           transitions visibility and blocks focus for a frame */
        transition:none !important;
        scroll-behavior:auto !important;
    }
}

html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after{
    animation-play-state:paused !important;
}

@media (prefers-reduced-transparency:reduce){

    body::before{
        opacity:.35;
    }
}
