/* ============================================================
   MegaAI Solutions: site-wide design system
   Loaded on every page. Owns the tokens, typography, header,
   footer, atmosphere and the shared content primitives.
   Page-specific work lives alongside it (e.g. css/ms-home.css).
   ============================================================ */

:root{
  --ink:#05030c;
  --ink-2:#0a0714;
  --surface:#100a1c;
  --surface-2:#170f26;

  --line:rgba(255,255,255,.09);
  --line-strong:rgba(255,255,255,.18);

  --bone:#f4f2f7;
  --bone-dim:rgba(244,242,247,.68);
  --bone-faint:rgba(244,242,247,.40);

  --accent:#b724ff;
  --accent-deep:#8f00d6;
  --accent-glow:#e23bff;
  --cyan:#27e7ff;

  --font-display:'Archivo','Space Grotesk','Helvetica Neue',Arial,sans-serif;
  --font-serif:'Instrument Serif',Georgia,serif;
  --font-body:'Space Grotesk',system-ui,sans-serif;

  --ease-out:cubic-bezier(.16,1,.3,1);
  --ease-io:cubic-bezier(.65,0,.35,1);
  --ma-ease:cubic-bezier(.22,1,.36,1);

  --pad:clamp(1.25rem,5vw,5.5rem);
  --maxw:1440px;
}

/* ------------------------------------------------------------
   Page ground
   ------------------------------------------------------------ */

html{scroll-behavior:smooth;}

body{
  background:var(--ink) !important;
  color:var(--bone);
  font-family:var(--font-body);
  overflow-x:clip;
}

/* Every page used to carry a busy fixed photo behind the copy, which cost
   more legibility than it bought atmosphere. A quiet violet field replaces it
   and lets the content sections do the work. */
body::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:-3;
  background-image:
    radial-gradient(120% 70% at 50% -12%,rgba(122,24,255,.20),transparent 58%),
    radial-gradient(90% 60% at 90% 108%,rgba(183,36,255,.14),transparent 62%),
    linear-gradient(180deg,#05030c 0%,#07040f 55%,#05030c 100%) !important;
  background-size:cover !important;
  background-position:center !important;
  background-repeat:no-repeat !important;
}

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

::-webkit-scrollbar{width:9px;}
::-webkit-scrollbar-track{background:var(--ink);}
::-webkit-scrollbar-thumb{background:#2a2036;border-radius:9px;}
::-webkit-scrollbar-thumb:hover{background:var(--accent-deep);}

/* ------------------------------------------------------------
   Atmosphere (injected by ms-site.js)
   ------------------------------------------------------------ */

.ms-grain{
  position:fixed;
  inset:-50%;
  z-index:9990;
  pointer-events:none;
  opacity:.05;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%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");
  animation:msgrain .7s steps(3) infinite;
}
@keyframes msgrain{
  0%{transform:translate(0,0);}
  33%{transform:translate(-2%,1.5%);}
  66%{transform:translate(1.5%,-1%);}
  100%{transform:translate(0,0);}
}
.ms-vignette{
  position:fixed;
  inset:0;
  z-index:9989;
  pointer-events:none;
  background:radial-gradient(ellipse at 50% 45%,transparent 44%,rgba(0,0,0,.58) 100%);
}

/* ------------------------------------------------------------
   Typography
   Words in the display face were running together: the tight tracking that
   makes the face look designed also eats the word gaps, so word-spacing has
   to be paid back explicitly.
   ------------------------------------------------------------ */

.ms-display,
.megaai .display{
  font-family:var(--font-display);
  font-weight:900;
  line-height:.9;
  letter-spacing:-.028em;
  word-spacing:.14em;
  text-transform:uppercase;
  margin:0;
  color:var(--bone);
}
.megaai .d-xl{font-size:clamp(2.5rem,min(8.8vw,11.8vh),8rem);}
.megaai .d-lg{font-size:clamp(2.2rem,6.6vw,5.6rem);}
.megaai .d-md{font-size:clamp(1.85rem,5vw,4.2rem);}
.megaai .d-sm{font-size:clamp(1.35rem,3vw,2.5rem);line-height:.98;}

.megaai .serif,
.ms-serif{
  font-family:var(--font-serif);
  font-style:italic;
  font-weight:400;
  text-transform:none;
  letter-spacing:-.005em;
  word-spacing:.04em;
  color:var(--bone);
}

.megaai .eyebrow,
.ms-eyebrow{
  font-family:var(--font-body);
  font-size:clamp(.62rem,.85vw,.75rem);
  font-weight:600;
  letter-spacing:.28em;
  text-transform:uppercase;
  color:var(--bone-faint);
  margin:0;
  display:flex;
  align-items:center;
  gap:.85em;
}
.megaai .eyebrow::before,
.ms-eyebrow::before{
  content:"";
  width:clamp(18px,3vw,46px);
  height:1px;
  background:var(--accent);
  flex:none;
}
.megaai .eyebrow.centered,
.ms-eyebrow.centered{justify-content:center;}

.megaai .lede,
.ms-lede{
  font-size:clamp(1rem,1.35vw,1.18rem);
  line-height:1.65;
  color:var(--bone-dim);
  max-width:60ch;
  margin:0;
}
.megaai .mono-num,
.ms-mono{font-variant-numeric:tabular-nums;font-feature-settings:'tnum';}

/* The previous design hung a glowing rule and a float animation off every
   heading. The type system carries its own accents now. */
.megaai h1::after,.megaai h2::after,.megaai h3::after{
  content:none !important;
  display:none !important;
}
.megaai h1,.megaai h2,.megaai h3{animation:none !important;}

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

.megaai .shell,
.ms-shell{
  width:100%;
  max-width:var(--maxw);
  margin-inline:auto;
  padding-inline:var(--pad);
}
.megaai .ms-section,
.ms-section{
  position:relative;
  padding-block:clamp(5rem,12vh,9.5rem);
  background:transparent;
}
.megaai .ms-head,
.ms-head{
  display:flex;
  flex-direction:column;
  gap:clamp(1rem,2vw,1.6rem);
  margin-bottom:clamp(2.5rem,5vw,4.5rem);
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */

.megaai .btn,
.ms-btn{
  --btn-bg:var(--bone);
  --btn-fg:var(--ink);
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:.7em;
  padding:1.05em 2em;
  border-radius:100px;
  font-family:var(--font-body);
  font-size:clamp(.72rem,.9vw,.82rem);
  font-weight:700;
  letter-spacing:.16em;
  text-transform:uppercase;
  background:var(--btn-bg);
  color:var(--btn-fg);
  text-decoration:none;
  overflow:hidden;
  isolation:isolate;
  border:0;
  transition:color .45s var(--ease-out),transform .45s var(--ease-out),
             box-shadow .45s var(--ease-out);
  will-change:transform;
}
.megaai .btn::before,
.ms-btn::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  background:var(--accent);
  transform:translateY(101%);
  transition:transform .55s var(--ease-out);
}
.megaai .btn:hover,
.ms-btn:hover{color:#fff;transform:translateY(-2px);}
.megaai .btn:hover::before,
.ms-btn:hover::before{transform:translateY(0);}
.megaai .btn .arw,
.ms-btn .arw{transition:transform .45s var(--ease-out);}
.megaai .btn:hover .arw,
.ms-btn:hover .arw{transform:translateX(4px);}

.megaai .btn-ghost,
.ms-btn-ghost{
  --btn-bg:transparent;
  --btn-fg:var(--bone);
  box-shadow:inset 0 0 0 1px var(--line-strong);
}
.megaai .btn-accent,
.ms-btn-accent{
  --btn-bg:var(--accent-deep);
  --btn-fg:#fff;
  box-shadow:0 14px 44px -12px rgba(183,36,255,.55);
}
.megaai .btn-accent::before,
.ms-btn-accent::before{background:var(--bone);}
.megaai .btn-accent:hover,
.ms-btn-accent:hover{color:var(--ink);}

/* ------------------------------------------------------------
   Cards: one surface treatment for every card on the site
   ------------------------------------------------------------ */

.ms-card-surface{
  position:relative;
  display:block;
  border-radius:20px;
  background:linear-gradient(165deg,rgba(38,22,62,.72) 0%,rgba(17,11,29,.86) 62%);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.12),
             inset 0 1px 0 0 rgba(255,255,255,.10),
             0 30px 70px -34px rgba(0,0,0,.95);
  transition:transform .5s var(--ease-out),box-shadow .5s var(--ease-out);
}
.ms-card-surface:hover{
  transform:translateY(-6px);
  box-shadow:inset 0 0 0 1px rgba(226,59,255,.5),
             0 40px 90px -34px rgba(0,0,0,.95),
             0 0 60px -18px rgba(183,36,255,.6);
}
.ms-icon-tile{
  width:92px;height:92px;
  display:grid;place-items:center;
  border-radius:18px;
  background:radial-gradient(circle at 30% 25%,rgba(183,36,255,.34),rgba(183,36,255,.10) 70%);
  box-shadow:inset 0 0 0 1px rgba(226,59,255,.45),0 0 34px -10px rgba(183,36,255,.75);
}
.ms-icon-tile img{
  width:62px;height:62px;object-fit:contain;display:block;
  filter:brightness(1.45) saturate(1.2) drop-shadow(0 0 12px rgba(226,59,255,.6));
}

/* Narrow cards cannot carry the full tile without crowding the title. */
@media (max-width:520px){
  .ms-icon-tile{width:76px;height:76px;}
  .ms-icon-tile img{width:50px;height:50px;}
}

/* ------------------------------------------------------------
   Header: floats over the page, glass once you leave the top
   ------------------------------------------------------------ */

#masthead,
body > header.site-header{
  position:fixed;
  top:0;left:0;right:0;
  z-index:600;
  background:transparent;
  transition:transform .55s var(--ease-out),background .5s var(--ease-out),
             border-color .5s var(--ease-out),backdrop-filter .5s var(--ease-out);
  border-bottom:1px solid transparent;
}
#masthead.ms-solid,
body > header.site-header.ms-solid{
  background:rgba(7,4,15,.74) !important;
  backdrop-filter:blur(18px) saturate(1.3);
  -webkit-backdrop-filter:blur(18px) saturate(1.3);
  border-bottom-color:var(--line);
}
#masthead.ms-hidden,
body > header.site-header.ms-hidden{transform:translateY(-104%);}

/* The logo sat on an opaque plate that read as a floating box over the hero. */
#masthead .site-branding,
#masthead .site-header-item{background:transparent !important;}

/* Pages that are not the landing page start their content under the header,
   so they need the height back. The landing page opts out. */
body:not(.ms-overlap-header) #inner-wrap{padding-top:var(--ms-hdr,96px);}

/* ------------------------------------------------------------
   Footer: the header's twin at the other end of the page
   ------------------------------------------------------------ */

#colophon,
body > footer.site-footer{
  position:relative;
  z-index:2;
  margin-top:clamp(3rem,8vh,6rem);
  background:rgba(7,4,15,.74) !important;
  backdrop-filter:blur(18px) saturate(1.3);
  -webkit-backdrop-filter:blur(18px) saturate(1.3);
  border-top:1px solid var(--line);
}

/* A hairline of accent light along the top edge, mirroring the header's
   bottom border once it goes solid. */
#colophon::before,
body > footer.site-footer::before{
  content:"";
  position:absolute;
  left:0;right:0;top:-1px;
  height:1px;
  background:linear-gradient(90deg,transparent,rgba(183,36,255,.7),transparent);
  pointer-events:none;
}

#colophon .site-footer-wrap{padding-block:clamp(1.6rem,3vh,2.4rem);}
#colophon .site-middle-footer-wrap,
#colophon .site-bottom-footer-wrap{background:transparent !important;}

/* Footer navigation gets the header's link treatment: same size, same
   tracking, same underline sweep, same hover colour. */
#colophon .footer-menu-container .menu,
body > footer.site-footer nav ul{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap:clamp(1.4rem,3.4vw,3rem);
  list-style:none;
  margin:0;
  padding:0;
}
#colophon .menu-item a,
body > footer.site-footer nav a{
  position:relative;
  display:inline-block;
  font-family:var(--font-body) !important;
  font-weight:500 !important;
  font-size:15px !important;
  letter-spacing:.4px !important;
  color:rgba(255,255,255,.8) !important;
  text-decoration:none !important;
  padding:6px 2px !important;
  transition:color .3s var(--ease-out);
}
#colophon .menu-item a::after,
body > footer.site-footer nav a::after{
  content:"";
  position:absolute;
  left:0;bottom:-4px;
  width:100%;
  height:1px;
  background:var(--accent);
  transform:scaleX(0);
  transform-origin:right;
  transition:transform .45s var(--ease-out);
}
#colophon .menu-item a:hover,
body > footer.site-footer nav a:hover{color:#fff !important;}
#colophon .menu-item a:hover::after,
body > footer.site-footer nav a:hover::after{
  transform:scaleX(1);
  transform-origin:left;
}

/* Divider between the link row and the copyright line, same hairline the
   header uses. */
#colophon .site-bottom-footer-wrap{border-top:1px solid var(--line);}
#colophon .footer-html p,
#colophon .site-info p{
  font-family:var(--font-body);
  font-size:.78rem;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--bone-faint);
  margin:0;
  text-align:center;
}

/* ------------------------------------------------------------
   Scroll reveals (ms-site.js tags these)
   ------------------------------------------------------------ */

.ms-rv{
  opacity:0;
  transform:translateY(28px);
  transition:opacity .9s var(--ease-out),transform .9s var(--ease-out);
  will-change:opacity,transform;
}
.ms-rv.ms-in{opacity:1;transform:none;}
.no-motion .ms-rv{opacity:1 !important;transform:none !important;}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
  .ms-grain{animation:none;}
  .ms-rv{opacity:1 !important;transform:none !important;transition:none;}
}
