/* ==========================================================================
   Priostack Apps design system - base.css
   Reset, typography, links, focus, reduced motion, print basics.
   Needs tokens.css first. No selectors here carry layout opinions: the
   components do that.
   ========================================================================== */

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

/* No smooth scrolling: in-page jumps (skip link, anchors) are instant, as the
   spec allows no motion beyond 150 ms transitions. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  margin: 0;
  font-family: var(--ps-font-sans);
  font-size: var(--ps-text-md);
  line-height: var(--ps-leading);
  font-weight: var(--ps-weight-regular);
  color: var(--ps-text);
  background-color: var(--ps-bg);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* A theme island repaints itself in its own theme. */
[data-theme] {
  color: var(--ps-text);
  background-color: var(--ps-bg);
}

/* Typography ------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--ps-weight-bold);
  line-height: var(--ps-leading-tight);
  letter-spacing: var(--ps-tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--ps-text-3xl); }
h2 { font-size: var(--ps-text-2xl); font-weight: var(--ps-weight-semibold); }
h3 { font-size: var(--ps-text-xl); font-weight: var(--ps-weight-semibold); }
h4,
h5,
h6 { font-size: var(--ps-text-md); font-weight: var(--ps-weight-semibold); letter-spacing: 0; }

p,
ul,
ol,
dl,
dd,
figure,
blockquote,
pre {
  margin: 0;
}

ul,
ol {
  padding-left: 1.25em;
}

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

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

small {
  font-size: var(--ps-text-sm);
}

code,
kbd,
samp,
pre {
  font-family: var(--ps-font-mono);
  font-size: 0.9375em;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

hr {
  height: 0;
  margin: var(--ps-space-6) 0;
  border: 0;
  border-top: 1px solid var(--ps-line);
}

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

table {
  border-collapse: collapse;
  border-spacing: 0;
}

th {
  font-weight: var(--ps-weight-semibold);
  text-align: start;
}

/* Links: underlined in text, so colour is never the only cue (1.4.1). */
a {
  color: var(--ps-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

@media (hover: hover) {
  a:hover {
    color: var(--ps-link-hover);
    text-decoration-thickness: 2px;
  }
}

/* Forms ------------------------------------------------------------------ */
button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button,
[type="button"],
[type="submit"],
[type="reset"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

summary {
  cursor: pointer;
}

::placeholder {
  color: var(--ps-text-muted);
  opacity: 1;
}

::selection {
  color: var(--ps-text);
  background-color: var(--ps-selection);
}

/* Focus: one visible ring everywhere, orange, outside the element. ------- */
:focus-visible {
  outline: var(--ps-focus-width) solid var(--ps-focus);
  outline-offset: var(--ps-focus-offset);
}

/* Hidden, and hidden but read ------------------------------------------- */
[hidden] {
  display: none !important;
}

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

/* Motion ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Windows high contrast and other forced palettes ----------------------- */
@media (forced-colors: active) {
  :focus-visible {
    outline-color: Highlight;
  }
}

/* Print basics (documents: see print.css) -------------------------------- */
@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: none;
  }

  a {
    color: inherit;
  }

  h1,
  h2,
  h3,
  h4 {
    break-after: avoid;
  }

  tr,
  img,
  svg,
  figure,
  blockquote,
  pre {
    break-inside: avoid;
  }

  p {
    orphans: 3;
    widows: 3;
  }
}
