/* Isilumko AI Library: base layer.
   Reset, typography, theming hygiene (HANDOFF s13), theme switch (MOTION-SPEC s7b + s8)
   and the global reduced-motion rules. Load order on every page:
   /tokens.css -> /base.css -> /components.css -> /shell.css -> /pages/<page>.css
   Tokens only: no raw colours in this file (the reveal overlay colour is read from tokens.css at runtime). */

/* ---------------------------------------------------------------- reset */
*,*::before,*::after{box-sizing:border-box}
*{margin:0;padding:0}
html{
  -webkit-text-size-adjust:100%;text-size-adjust:100%;
  background:var(--bg);
  scrollbar-color:var(--scrollbar-thumb) var(--scrollbar-track);
}
/* Metric-matched stand-in for the moment before Montserrat arrives (display=swap): Arial scaled to
   Montserrat's width, ascent and descent, so the swap does not reflow text (no layout shift). */
@font-face{font-family:'Montserrat Fallback';src:local('Arial'),local('ArialMT');size-adjust:112.83%;ascent-override:85.79%;descent-override:22.25%;line-gap-override:0%}
body{
  min-height:100vh;
  font-family:'Montserrat','Montserrat Fallback',system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  font-size:14px;line-height:1.5;font-weight:400;
  color:var(--text);background:var(--bg);
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;
}
img,picture,video,canvas{display:block;max-width:100%}
svg{flex:none}
button,input,select,textarea{font:inherit;color:inherit;letter-spacing:inherit}
button{background:none;border:0;cursor:pointer;text-align:inherit}
button:disabled{cursor:not-allowed}
a{color:inherit;text-decoration:none}
ul,ol{list-style:none}
h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:700;line-height:1.25}
table{border-collapse:collapse}
[hidden]{display:none!important}
::selection{background:var(--accent-tint);color:var(--text)}

/* ------------------------------------------------------- focus (s13 r7) */
:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px}
:focus:not(:focus-visible){outline:none}

/* ------------------------------------------------ form controls (s13) */
input,textarea,select{background:var(--input-bg);color:var(--input-text);border:1px solid var(--input-border)}
input:hover,textarea:hover,select:hover{border-color:var(--input-border-hover)}
input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--focus-ring);outline-offset:1px}
input:disabled,textarea:disabled,select:disabled{background:var(--disabled-bg);color:var(--disabled-text);border-color:var(--disabled-border)}
::placeholder{color:var(--placeholder);opacity:1}
/* the native clear (x) ignores tokens (blue in light); Escape clears search fields instead */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration{-webkit-appearance:none}
/* autofill (s13 r5): Chrome, Edge and Safari paint their own yellow/white otherwise */
input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus,
textarea:-webkit-autofill,select:-webkit-autofill{
  -webkit-text-fill-color:var(--autofill-text);
  box-shadow:0 0 0 1000px var(--autofill-bg) inset;
  caret-color:var(--autofill-text);
}
input:autofill{color:var(--autofill-text);box-shadow:0 0 0 1000px var(--autofill-bg) inset}
/* native select: keep the platform arrow (color-scheme from tokens.css themes it) and theme the option list */
select option,select optgroup{background-color:var(--input-bg);color:var(--input-text)}
input[type="checkbox"],input[type="radio"],input[type="range"],progress{accent-color:var(--accent)}

/* scrollbars (s13 r6): scrollbar-color is set on html above; this is the WebKit fallback */
::-webkit-scrollbar{width:12px;height:12px}
::-webkit-scrollbar-track{background:var(--scrollbar-track)}
::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:999px;border:3px solid var(--scrollbar-track)}
::-webkit-scrollbar-corner{background:var(--scrollbar-track)}

/* --------------------------------------------------------- utilities */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

/* ------------------------------------- theme switch (MOTION-SPEC s7b) */
/* Sun/moon morph. Markup comes from themeIconSVG() in /theme.js. Light = sun, dark = moon. */
.theme-icon{display:block;width:22px;height:22px;overflow:visible}
.theme-icon .core{transform-box:view-box;transform-origin:12px 12px;transform:scale(.55);transition:transform .55s cubic-bezier(.4,1.4,.5,1)}
.theme-icon .mm{transition:transform .55s cubic-bezier(.4,1.2,.5,1)}
.theme-icon .rays{transform-box:view-box;transform-origin:12px 12px;transition:transform .55s cubic-bezier(.2,.7,.2,1),opacity .3s}
[data-theme="dark"] .theme-icon .core{transform:scale(1)}
[data-theme="dark"] .theme-icon .mm{transform:translate(-11px,4px)}
[data-theme="dark"] .theme-icon .rays{transform:rotate(-60deg) scale(.4);opacity:0}

/* Clean-circle reveal (MOTION-SPEC s8). theme.js drives the clip-path; the defaults would cross-fade. */
::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}
/* the root group's default UA animation would tween width/height/backdrop-filter (a no-op here); keep the reveal clip-path only */
::view-transition-group(root){animation:none}
/* Fallback when View Transitions are missing: a sheet in the next theme's --bg (read from tokens.css). */
.theme-reveal-overlay{position:fixed;inset:0;z-index:2147483000;pointer-events:none}

/* ------------------------------------------ reduced motion (MOTION-SPEC s0) */
/* Nothing moves: every animation and transition jumps to its end state immediately
   (still firing animationend/transitionend, so JS that waits for them keeps working). */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.01ms!important;animation-delay:0s!important;animation-iteration-count:1!important;
    transition-duration:.01ms!important;transition-delay:0s!important;
    scroll-behavior:auto!important;
  }
}
