/* The only global CSS of the product: what StyleX cannot target. Plain CSS linked before stylex.css, whose layers
   therefore come after this one and win wherever both apply. */

@layer base {
  /* Copies of DESIGN.md tokens, named --color-*, --gradient-* and --font-* after them, because StyleX hashes its variable
     names; script/check_design_tokens.ts fails when one differs from app/javascript/styles. */
  :root {
    --color-background-canvas: #f8fafc;
    --color-text-primary: #1e293b;
    --color-primary-border: #add3ff;
    --color-border-default: #cbd5e1;
    --color-annotation: #e11919;
    --gradient-progress: linear-gradient(
      90deg,
      #3b82f6 0%,
      #3aa9f7 48.56%,
      #38d2f8 100%
    );
    --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    /* Scrollbar color used by primitives.css. */
    --color-scrollbar: var(--color-border-default);
  }

  /* The reset StyleX styles build on: no user-agent box model, spacing, borders or typography. */
  *,
  ::before,
  ::after,
  ::backdrop {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0 solid;
  }

  html {
    background-color: var(--color-background-canvas);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    min-height: 100vh;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-size: inherit;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  th,
  b,
  strong {
    font-weight: 500;
  }

  a {
    color: inherit;
    text-decoration: inherit;
    transition-property: color, background-color, border-color;
    transition-duration: 150ms;
  }

  ol,
  ul {
    list-style: none;
  }

  table {
    border-collapse: collapse;
  }

  img,
  svg {
    display: block;
    vertical-align: middle;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  button,
  input,
  textarea {
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    background-color: transparent;
    border-radius: 0;
    opacity: 1;
  }

  textarea {
    resize: vertical;
  }

  code,
  pre {
    font-family:
      ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
      monospace;
    font-size: 1em;
  }

  [hidden]:where(:not([hidden="until-found"])) {
    /* biome-ignore lint/complexity/noImportantStyles: the hidden attribute must win over a StyleX display, as on review marks. */
    display: none !important;
  }

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

  /* After a pointer press no element draws a focus ring, not even one Base UI focuses again when a popup closes. */
  :root[data-input-modality="pointer"] :focus {
    /* biome-ignore lint/complexity/noImportantStyles: StyleX rings come in later layers and match :focus-visible. */
    outline: none !important;
  }

  ::view-transition-group(*) {
    animation-duration: 180ms;
    animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
  }

  ::view-transition-old(root) {
    display: none;
  }

  ::view-transition-new(root) {
    animation: none;
  }

  @media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*) {
      animation-duration: 0s;
    }
  }

  /* A page's PageDrawing over its scan (JobResultsHelper), in points of its paper, scaling with it as the printed
     sheet does. */
  .result-markup [data-meta-position="top_right"],
  [data-score-position="top_right"]
    .result-markup
    [data-meta-position="top_left"] {
    display: none;
  }

  [data-score-position="top_right"]
    .result-markup
    [data-meta-position="top_right"] {
    display: inline;
  }

  .result-markup {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    color: var(--color-annotation);
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .result-markup .result-markup-summary {
    color: var(--color-annotation);
  }

  .result-markup .result-markup-text {
    fill: currentColor;
    stroke: none;
  }

  .result-markup .result-markup-text.result-markup-summary {
    stroke: currentColor;
  }

  /* The student's identity header, printed black as JobMarkerPdfExporter draws meta lines. */
  .result-markup .result-markup-text.result-markup-identity {
    color: #000000;
    stroke: currentColor;
  }

  /* A half check's own loss, thickened as the PDF strokes it. */
  .result-markup .result-markup-text.result-markup-bold {
    stroke: currentColor;
  }

  .result-markup .result-markup-glyph {
    fill: currentColor;
    fill-rule: evenodd;
    stroke: none;
  }

  .result-markup .result-markup-glyph[stroke-width] {
    stroke: currentColor;
  }

  /* Thumbnails (data-markup="preview") leave out the comments; the viewer's toggle hides the marks. */
  [data-markup="preview"] .result-markup-comment,
  [data-markers="hidden"] .result-markup-marks {
    display: none;
  }
}
